/* Generated by Cython 0.29.22 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_22"
#define CYTHON_HEX_VERSION 0x001D16F0
#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 CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

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

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

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

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

#define __PYX_HAVE__mathics__core__expression
#define __PYX_HAVE_API__mathics__core__expression
/* Early includes */
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

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

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

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


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

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "mathics/core/expression.py",
};

/*--- Type declarations ---*/
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr;
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr;
struct __pyx_defaults;
typedef struct __pyx_defaults __pyx_defaults;
struct __pyx_defaults {
  PyObject *__pyx_arg_options;
};

/* "mathics/core/expression.py":208
 *         return ExpressionCache(self.time, self.symbols, self.sequences)
 * 
 *     def sliced(self, lower, upper):             # <<<<<<<<<<<<<<
 *         # indicates that the Expression's leaves have been slices with
 *         # the given indices.
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced {
  PyObject_HEAD
  PyObject *__pyx_v_a;
  PyObject *__pyx_v_b;
  PyObject *__pyx_v_lower;
  PyObject *__pyx_v_seq;
};


/* "mathics/core/expression.py":217
 *             a = bisect_left(seq, lower)  # all(val >= i for val in seq[a:])
 *             b = bisect_left(seq, upper)  # all(val >= j for val in seq[b:])
 *             new_sequences = tuple(x - lower for x in seq[a:b])             # <<<<<<<<<<<<<<
 *         elif seq is not None:
 *             new_sequences = tuple()
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *__pyx_outer_scope;
  PyObject *__pyx_v_x;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "mathics/core/expression.py":404
 *         return self, False
 * 
 *     def do_format(self, evaluation, form):             # <<<<<<<<<<<<<<
 *         """
 *         Applies formats associated to the expression and removes
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format {
  PyObject_HEAD
  PyObject *__pyx_v_evaluation;
  PyObject *__pyx_v_form;
};


/* "mathics/core/expression.py":657
 *         return self.__cmp(other) != 0
 * 
 *     def __cmp(self, other) -> int:             # <<<<<<<<<<<<<<
 *         self_exps = self.exps.copy()
 *         other_exps = other.exps.copy()
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp {
  PyObject_HEAD
  PyObject *__pyx_v_other_exps;
  PyObject *__pyx_v_self_exps;
};


/* "mathics/core/expression.py":669
 *                 if not other_exps[var]:
 *                     del other_exps[var]
 *         self_exps = sorted((var, exp) for var, exp in self_exps.items())             # <<<<<<<<<<<<<<
 *         other_exps = sorted((var, exp) for var, exp in other_exps.items())
 * 
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *__pyx_outer_scope;
  PyObject *__pyx_v_exp;
  PyObject *__pyx_v_var;
};


/* "mathics/core/expression.py":670
 *                     del other_exps[var]
 *         self_exps = sorted((var, exp) for var, exp in self_exps.items())
 *         other_exps = sorted((var, exp) for var, exp in other_exps.items())             # <<<<<<<<<<<<<<
 * 
 *         index = 0
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *__pyx_outer_scope;
  PyObject *__pyx_v_exp;
  PyObject *__pyx_v_var;
};


/* "mathics/core/expression.py":714
 *     _sequences: Any
 * 
 *     def __new__(cls, head, *leaves, **kwargs) -> "Expression":             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if isinstance(head, str):
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ {
  PyObject_HEAD
  PyObject *__pyx_v_leaves;
};


/* "mathics/core/expression.py":719
 *             head = Symbol(head)
 *         self._head = head
 *         self._leaves = tuple(from_python(leaf) for leaf in leaves)             # <<<<<<<<<<<<<<
 *         self._sequences = None
 *         self._format_cache = None
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *__pyx_outer_scope;
  PyObject *__pyx_v_leaf;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
};


/* "mathics/core/expression.py":843
 *         return self._flatten_sequence(sequence, evaluation)
 * 
 *     def flatten_pattern_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence {
  PyObject_HEAD
  PyObject *__pyx_v_evaluation;
};


/* "mathics/core/expression.py":903
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)
 * 
 *     def copy(self, reevaluate=False) -> "Expression":             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy {
  PyObject_HEAD
  PyObject *__pyx_v_reevaluate;
  PyObject *__pyx_v_self;
};


/* "mathics/core/expression.py":905
 *     def copy(self, reevaluate=False) -> "Expression":
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)             # <<<<<<<<<<<<<<
 *         if not reevaluate:
 *             # rebuilding the cache in self speeds up large operations, e.g.
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *__pyx_outer_scope;
  PyObject *__pyx_v_leaf;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "mathics/core/expression.py":974
 *             self._cache = self._cache.reordered()
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:
 *             res = self._leaves[2]
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes {
  PyObject_HEAD
  PyObject *__pyx_v_res;
};


/* "mathics/core/expression.py":980
 *                 return (str(res),)
 *             elif res.has_form("List", None):
 *                 return set(str(a) for a in res._leaves)             # <<<<<<<<<<<<<<
 *         return set()
 * 
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *__pyx_outer_scope;
  PyObject *__pyx_v_a;
};


/* "mathics/core/expression.py":1017
 *         return True
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         if self._no_symbol(symbol_name):
 *             return False
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol {
  PyObject_HEAD
  PyObject *__pyx_v_self;
  PyObject *__pyx_v_symbol_name;
};


/* "mathics/core/expression.py":1021
 *             return False
 *         return self._head.has_symbol(symbol_name) or any(
 *             leaf.has_symbol(symbol_name) for leaf in self._leaves             # <<<<<<<<<<<<<<
 *         )
 * 
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *__pyx_outer_scope;
  PyObject *__pyx_v_leaf;
};


/* "mathics/core/expression.py":1110
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 * 
 *         if pattern_sort:
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key {
  PyObject_HEAD
  PyObject *__pyx_v_self;
};


/* "mathics/core/expression.py":1147
 *                     0,
 *                     self._head.get_sort_key(True),
 *                     tuple(leaf.get_sort_key(True) for leaf in self._leaves),             # <<<<<<<<<<<<<<
 *                     1,
 *                 ]
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *__pyx_outer_scope;
  PyObject *__pyx_v_leaf;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "mathics/core/expression.py":1205
 *                     tuple(
 *                         chain(
 *                             (leaf.get_sort_key(True) for leaf in self._leaves), ([4],)             # <<<<<<<<<<<<<<
 *                         )
 *                     ),
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *__pyx_outer_scope;
  PyObject *__pyx_v_leaf;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "mathics/core/expression.py":1345
 *         return expr
 * 
 *     def evaluate_next(self, evaluation) -> typing.Tuple["Expression", bool]:             # <<<<<<<<<<<<<<
 *         from mathics.builtin.base import BoxConstruct
 * 
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next {
  PyObject_HEAD
  PyObject *__pyx_v_attributes;
  PyObject *__pyx_v_evaluation;
  PyObject *__pyx_v_leaves;
  PyObject *__pyx_v_new;
  PyObject *__pyx_v_self;
};


/* "mathics/core/expression.py":1430
 *                     return threaded, True
 * 
 *         def rules():             # <<<<<<<<<<<<<<
 *             rules_names = set()
 *             if "System`HoldAllComplete" not in attributes:
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *__pyx_outer_scope;
  PyObject *__pyx_v_leaf;
  PyObject *__pyx_v_lookup_name;
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_rule;
  PyObject *__pyx_v_rules_names;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
  PyObject *__pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
};


/* "mathics/core/expression.py":1546
 *             options = options.copy()
 * 
 *             def is_list_interior(content):             # <<<<<<<<<<<<<<
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior {
  PyObject_HEAD
  PyObject *__pyx_v_content;
};


/* "mathics/core/expression.py":1548
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]             # <<<<<<<<<<<<<<
 *                 ):
 *                     return True
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *__pyx_outer_scope;
  PyObject *__pyx_v_leaf;
};


/* "mathics/core/expression.py":1687
 *             return [leaf for leaf in self._leaves if leaf.get_head_name() == head_name]
 * 
 *     def apply_rules(self, rules, evaluation, level=0, options=None):             # <<<<<<<<<<<<<<
 *         """for rule in rules:
 *         result = rule.apply(self, evaluation, fully=False)
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules {
  PyObject_HEAD
  PyObject *__pyx_v_apply_leaf;
  PyObject *__pyx_v_evaluation;
  PyObject *__pyx_v_level;
  PyObject *__pyx_v_new_applied;
  PyObject *__pyx_v_options;
  PyObject *__pyx_v_rules;
};


/* "mathics/core/expression.py":1726
 *             return expr, new_applied[0]
 * 
 *     def replace_vars(             # <<<<<<<<<<<<<<
 *         self, vars, options=None, in_scoping=True, in_function=True
 *     ) -> "Expression":
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars {
  PyObject_HEAD
  PyObject *__pyx_v_get_scoping_vars;
  PyObject *__pyx_v_self;
};


/* "mathics/core/expression.py":1739
 * 
 *                 scoping_vars = set(
 *                     name for name, new_def in get_scoping_vars(self._leaves[0])             # <<<<<<<<<<<<<<
 *                 )
 *                 """for var in new_vars:
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *__pyx_outer_scope;
  PyObject *__pyx_v_name;
  PyObject *__pyx_v_new_def;
};


/* "mathics/core/expression.py":1838
 *             return True, Expression(head, *leaves)
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             self._head.get_name()
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric {
  PyObject_HEAD
  PyObject *__pyx_v_self;
};


/* "mathics/core/expression.py":1852
 *                 "Sin",
 *             )
 *             and all(leaf.is_numeric() for leaf in self._leaves)             # <<<<<<<<<<<<<<
 *         )
 *         # TODO: complete list of numeric functions, or access NumericFunction
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *__pyx_outer_scope;
  PyObject *__pyx_v_leaf;
};


/* "mathics/core/expression.py":2067
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name
 * 
 *     def replace_vars(self, vars, options={}, in_scoping=True):             # <<<<<<<<<<<<<<
 *         assert all(fully_qualified_symbol_name(v) for v in vars)
 *         var = vars.get(self.name, None)
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars {
  PyObject_HEAD
  PyObject *__pyx_v_vars;
};


/* "mathics/core/expression.py":2068
 * 
 *     def replace_vars(self, vars, options={}, in_scoping=True):
 *         assert all(fully_qualified_symbol_name(v) for v in vars)             # <<<<<<<<<<<<<<
 *         var = vars.get(self.name, None)
 *         if var is None:
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *__pyx_outer_scope;
  PyObject *__pyx_v_v;
};


/* "mathics/core/expression.py":2786
 * 
 * 
 * def encode_tex(text: str, in_text=False) -> str:             # <<<<<<<<<<<<<<
 *     def replace(match):
 *         c = match.group(1)
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex {
  PyObject_HEAD
  PyObject *__pyx_v_in_text;
};


/* "mathics/core/expression.py":3114
 * 
 * 
 * def _is_neutral_symbol(symbol_name, cache, evaluation):             # <<<<<<<<<<<<<<
 *     # a symbol is neutral if it does not invoke any rules, but is sure to make its Expression stay
 *     # the way it is (e.g. List[1, 2, 3] will always stay List[1, 2, 3], so long as nobody defines
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol {
  PyObject_HEAD
  PyObject *__pyx_v_definition;
};


/* "mathics/core/expression.py":3131
 *     else:
 *         r = all(
 *             len(definition.get_values_list(x)) == 0             # <<<<<<<<<<<<<<
 *             for x in ("up", "sub", "down", "own")
 *         )
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *__pyx_outer_scope;
  PyObject *__pyx_v_x;
};


/* "mathics/core/expression.py":3263
 * 
 * 
 * def atom_list_constructor(evaluation, head, *atom_names):             # <<<<<<<<<<<<<<
 *     # if we encounter an Expression that consists wholly of atoms and those atoms (and the
 *     # expression's head) have no rules associated with them, we can speed up evaluation.
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor {
  PyObject_HEAD
  PyObject *__pyx_v_atom_names;
  PyObject *__pyx_v_evaluation;
  PyObject *__pyx_v_full_atom_names;
  PyObject *__pyx_v_head;
};


/* "mathics/core/expression.py":3271
 * 
 *     if not _is_neutral_head(head, None, evaluation) or any(
 *         not atom for atom in atom_names             # <<<<<<<<<<<<<<
 *     ):
 *         optimize = False
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *__pyx_outer_scope;
  PyObject *__pyx_v_atom;
};


/* "mathics/core/expression.py":3278
 * 
 *         if not all(
 *             _is_neutral_symbol(atom, None, evaluation) for atom in full_atom_names             # <<<<<<<<<<<<<<
 *         ):
 *             optimize = False
 */
struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *__pyx_outer_scope;
  PyObject *__pyx_v_atom;
};


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* ListExtend.proto */
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

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

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

/* PyDictContains.proto */
static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

/* CallUnboundCMethod2.proto */
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

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

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

/* pyfrozenset_new.proto */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);

/* PySetContains.proto */
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);

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

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

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

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

/* BuildPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
                                                int prepend_sign, char padding_char);

/* CIntToPyUnicode.proto */
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char);

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_EqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_EqObjC(op1, op2, floatval, inplace, zerodivision_check)\
    (PyObject_RichCompare(op1, op2, Py_EQ))
    #endif

/* PyObjectLookupSpecial.proto */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
#if PY_MAJOR_VERSION < 3
    if (unlikely(PyInstance_Check(obj)))
        return __Pyx_PyObject_GetAttrStr(obj, attr_name);
#endif
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#else
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
    ((likely(PyLong_CheckExact(x))) ?\
         (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
         PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
#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);

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

/* SliceTupleAndList.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

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

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

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

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

/* CyFunctionClassCell.proto */
static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj);

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

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

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

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

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

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

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

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

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


/* Module declarations from 'mathics.core.expression' */
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct__sliced = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_2_do_format = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_3___cmp = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_4_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_5_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_6___new__ = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_7_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_9_copy = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_10_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_12_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_14_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_16_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_17_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_19_rules = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_21_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_24_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_26_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_28_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_31_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_33_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_34_genexpr = 0;
static PyObject *__pyx_9genexpr40__pyx_v_7mathics_4core_10expression_c;
#define __Pyx_MODULE_NAME "mathics.core.expression"
extern int __pyx_module_is_main_mathics__core__expression;
int __pyx_module_is_main_mathics__core__expression = 0;

/* Implementation of 'mathics.core.expression' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_zip;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_OverflowError;
static PyObject *__pyx_builtin_reversed;
static const char __pyx_k_[] = "`";
static const char __pyx_k_0[] = "0";
static const char __pyx_k_9[] = "9";
static const char __pyx_k_E[] = "E";
static const char __pyx_k_I[] = "I";
static const char __pyx_k_N[] = "N";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_f[] = "f";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_q[] = "q";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_s[] = "{%s}";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_z[] = "z";
static const char __pyx_k_Pi[] = "Pi";
static const char __pyx_k__2[] = "``";
static const char __pyx_k__3[] = "";
static const char __pyx_k__4[] = "[[";
static const char __pyx_k__5[] = "]]";
static const char __pyx_k__7[] = "..";
static const char __pyx_k__8[] = "...";
static const char __pyx_k_eq[] = "__eq__";
static const char __pyx_k_ge[] = "__ge__";
static const char __pyx_k_gt[] = "&gt;";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_l1[] = "l1";
static const char __pyx_k_l2[] = "l2";
static const char __pyx_k_le[] = "__le__";
static const char __pyx_k_lt[] = "&lt;";
static const char __pyx_k_m1[] = "m1";
static const char __pyx_k_m2[] = "m2";
static const char __pyx_k_ne[] = "__ne__";
static const char __pyx_k_re[] = "re";
static const char __pyx_k_up[] = "up";
static const char __pyx_k_0_2[] = "0.";
static const char __pyx_k_0_9[] = "[0-9]+";
static const char __pyx_k_Abs[] = "Abs";
static const char __pyx_k_Any[] = "Any";
static const char __pyx_k_Box[] = "Box ";
static const char __pyx_k_Sin[] = "Sin";
static const char __pyx_k__33[] = "[";
static const char __pyx_k__34[] = ", ";
static const char __pyx_k__35[] = "]";
static const char __pyx_k__42[] = "^";
static const char __pyx_k__44[] = "/";
static const char __pyx_k__45[] = " ( ";
static const char __pyx_k__46[] = " ) ";
static const char __pyx_k__48[] = ",";
static const char __pyx_k__51[] = "{";
static const char __pyx_k__52[] = "}";
static const char __pyx_k__53[] = " ";
static const char __pyx_k__54[] = "_";
static const char __pyx_k__58[] = "\342\200\262";
static const char __pyx_k__59[] = "\342\200\262\342\200\262";
static const char __pyx_k__60[] = "}{";
static const char __pyx_k__65[] = "$";
static const char __pyx_k__69[] = ">";
static const char __pyx_k__70[] = "<";
static const char __pyx_k__71[] = ": ";
static const char __pyx_k__73[] = "*^";
static const char __pyx_k__75[] = ")";
static const char __pyx_k__80[] = "&";
static const char __pyx_k__81[] = "\"";
static const char __pyx_k__82[] = "\n";
static const char __pyx_k__88[] = ".";
static const char __pyx_k__89[] = "\342\205\206";
static const char __pyx_k__90[] = "\342\201\242";
static const char __pyx_k__94[] = "'";
static const char __pyx_k__95[] = "''";
static const char __pyx_k__96[] = "\342\210\236";
static const char __pyx_k__97[] = "\303\227";
static const char __pyx_k__98[] = "(";
static const char __pyx_k__99[] = "\343\200\232";
static const char __pyx_k_abs[] = "__abs__";
static const char __pyx_k_add[] = "__add__";
static const char __pyx_k_amp[] = "&amp;";
static const char __pyx_k_arg[] = "arg";
static const char __pyx_k_box[] = "box";
static const char __pyx_k_cls[] = "cls";
static const char __pyx_k_cmp[] = "__cmp";
static const char __pyx_k_ctx[] = "ctx";
static const char __pyx_k_d_2[] = "\\, d";
static const char __pyx_k_dec[] = "dec";
static const char __pyx_k_dim[] = "dim";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_dps[] = "dps";
static const char __pyx_k_exp[] = "exp";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_inf[] = "inf";
static const char __pyx_k_int[] = "\\int";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_man[] = "man";
static const char __pyx_k_min[] = "min";
static const char __pyx_k_mpc[] = "mpc";
static const char __pyx_k_mpf[] = "mpf";
static const char __pyx_k_mul[] = "__mul__";
static const char __pyx_k_neg[] = "__neg__";
static const char __pyx_k_new[] = "new";
static const char __pyx_k_now[] = "now";
static const char __pyx_k_old[] = "old";
static const char __pyx_k_own[] = "own";
static const char __pyx_k_pos[] = "__pos__";
static const char __pyx_k_pow[] = "__pow__";
static const char __pyx_k_res[] = "res";
static const char __pyx_k_ret[] = "ret";
static const char __pyx_k_rhs[] = "rhs";
static const char __pyx_k_s_2[] = "%s'";
static const char __pyx_k_s_3[] = "%s''";
static const char __pyx_k_s_4[] = "\"%s\"";
static const char __pyx_k_s_5[] = "%s";
static const char __pyx_k_s_6[] = "s";
static const char __pyx_k_s_s[] = "%s>%s";
static const char __pyx_k_seq[] = "seq";
static const char __pyx_k_sim[] = "\\sim{}";
static const char __pyx_k_str[] = "__str__";
static const char __pyx_k_sub[] = "sub";
static const char __pyx_k_sum[] = "\\sum";
static const char __pyx_k_sym[] = "sym";
static const char __pyx_k_tex[] = "tex";
static const char __pyx_k_var[] = "var";
static const char __pyx_k_xml[] = "xml";
static const char __pyx_k_zip[] = "zip";
static const char __pyx_k_Atom[] = "Atom";
static const char __pyx_k_Form[] = "_Form";
static const char __pyx_k_List[] = "List";
static const char __pyx_k_Null[] = "Null";
static const char __pyx_k_Plus[] = "Plus";
static const char __pyx_k_Real[] = "Real";
static const char __pyx_k_Rule[] = "Rule";
static const char __pyx_k_Slot[] = "Slot";
static const char __pyx_k_Sqrt[] = "Sqrt";
static const char __pyx_k_True[] = "True";
static const char __pyx_k__100[] = "\343\200\233";
static const char __pyx_k__101[] = "\342\210\253";
static const char __pyx_k__102[] = "\342\210\221";
static const char __pyx_k__103[] = "\342\210\217";
static const char __pyx_k__105[] = "\\";
static const char __pyx_k__106[] = "\\\\";
static const char __pyx_k__108[] = "\\\"";
static const char __pyx_k__111[] = "\"\"";
static const char __pyx_k__532[] = "-";
static const char __pyx_k__758[] = "\\{";
static const char __pyx_k__759[] = "\\}";
static const char __pyx_k__760[] = "\\_";
static const char __pyx_k__761[] = "\\$";
static const char __pyx_k__762[] = "%";
static const char __pyx_k__763[] = "\\%";
static const char __pyx_k__764[] = "#";
static const char __pyx_k__765[] = "\\#";
static const char __pyx_k__766[] = "\\&";
static const char __pyx_k__767[] = "~";
static const char __pyx_k__768[] = "|";
static const char __pyx_k__769[] = "$<$";
static const char __pyx_k__770[] = "$>$";
static const char __pyx_k__771[] = "([";
static const char __pyx_k__772[] = "])";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_atom[] = "atom";
static const char __pyx_k_base[] = "base";
static const char __pyx_k_body[] = "body";
static const char __pyx_k_call[] = "__call__";
static const char __pyx_k_cond[] = "cond";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_deps[] = "deps";
static const char __pyx_k_done[] = "done";
static const char __pyx_k_down[] = "down";
static const char __pyx_k_exit[] = "__exit__";
static const char __pyx_k_expr[] = "expr";
static const char __pyx_k_exps[] = "exps";
static const char __pyx_k_form[] = "form";
static const char __pyx_k_frac[] = "\\frac{";
  static const char __pyx_k_func[] = "func";
  static const char __pyx_k_gt_2[] = "__gt__";
  static const char __pyx_k_hash[] = "__hash__";
  static const char __pyx_k_head[] = "head";
  static const char __pyx_k_imag[] = "imag";
  static const char __pyx_k_init[] = "__init__";
  static const char __pyx_k_item[] = "item";
  static const char __pyx_k_keys[] = "keys";
  static const char __pyx_k_leaf[] = "leaf";
  static const char __pyx_k_line[] = "line";
  static const char __pyx_k_list[] = "list";
  static const char __pyx_k_lt_2[] = "__lt__";
  static const char __pyx_k_main[] = "__main__";
  static const char __pyx_k_math[] = "math";
  static const char __pyx_k_msub[] = "<msub>";
  static const char __pyx_k_msup[] = "<msup>";
  static const char __pyx_k_name[] = "name";
  static const char __pyx_k_nbsp[] = "&nbsp;";
  static const char __pyx_k_prec[] = "prec";
  static const char __pyx_k_prod[] = "\\prod";
  static const char __pyx_k_quot[] = "&quot;";
  static const char __pyx_k_real[] = "real";
  static const char __pyx_k_repl[] = "repl";
  static const char __pyx_k_repr[] = "__repr__";
  static const char __pyx_k_rule[] = "rule";
  static const char __pyx_k_self[] = "self";
  static const char __pyx_k_send[] = "send";
  static const char __pyx_k_slot[] = "slot";
  static const char __pyx_k_sort[] = "sort";
  static const char __pyx_k_step[] = "step";
  static const char __pyx_k_test[] = "__test__";
  static const char __pyx_k_tex1[] = "tex1";
  static const char __pyx_k_text[] = "text";
  static const char __pyx_k_time[] = "time";
  static const char __pyx_k_type[] = " (type ";
  static const char __pyx_k_user[] = "user";
  static const char __pyx_k_utf8[] = "utf8";
  static const char __pyx_k_vars[] = "vars";
  static const char __pyx_k_vert[] = "\\vert{}";
  static const char __pyx_k_False[] = "False";
  static const char __pyx_k_Float[] = "Float";
  static const char __pyx_k_Floor[] = "Floor";
  static const char __pyx_k_Minus[] = "Minus";
  static const char __pyx_k_Power[] = "Power";
  static const char __pyx_k_Times[] = "Times";
  static const char __pyx_k_Tuple[] = "Tuple";
  static const char __pyx_k_Union[] = "Union";
  static const char __pyx_k_apply[] = "apply";
  static const char __pyx_k_atoms[] = "atoms";
  static const char __pyx_k_block[] = "block";
  static const char __pyx_k_cache[] = "_cache";
  static const char __pyx_k_cfunc[] = "cfunc";
  static const char __pyx_k_chain[] = "chain";
  static const char __pyx_k_class[] = "__class__";
  static const char __pyx_k_close[] = "close";
  static const char __pyx_k_count[] = "count";
  static const char __pyx_k_enter[] = "__enter__";
  static const char __pyx_k_error[] = "error";
  static const char __pyx_k_float[] = "float";
  static const char __pyx_k_fully[] = "fully";
  static const char __pyx_k_group[] = "group";
  static const char __pyx_k_heads[] = "heads";
  static const char __pyx_k_index[] = "index";
  static const char __pyx_k_infty[] = "\\infty ";
  static const char __pyx_k_inner[] = "inner";
  static const char __pyx_k_int_2[] = "int";
  static const char __pyx_k_isinf[] = "isinf";
  static const char __pyx_k_isnan[] = "isnan";
  static const char __pyx_k_item1[] = "item1";
  static const char __pyx_k_item2[] = "item2";
  static const char __pyx_k_items[] = "items";
  static const char __pyx_k_itlim[] = "itlim";
  static const char __pyx_k_level[] = "level";
  static const char __pyx_k_limit[] = "limit";
  static const char __pyx_k_lower[] = "lower";
  static const char __pyx_k_match[] = "match";
  static const char __pyx_k_mfrac[] = "<mfrac>";
  static const char __pyx_k_minus[] = "minus";
  static const char __pyx_k_names[] = "names";
  static const char __pyx_k_new_2[] = "__new__";
  static const char __pyx_k_other[] = "other";
  static const char __pyx_k_parts[] = "parts";
  static const char __pyx_k_pos_2[] = "pos";
  static const char __pyx_k_range[] = "range";
  static const char __pyx_k_round[] = "round";
  static const char __pyx_k_rules[] = "rules";
  static const char __pyx_k_sameQ[] = "sameQ";
  static const char __pyx_k_sim_2[] = "$\\sim$";
  static const char __pyx_k_slice[] = "slice";
  static const char __pyx_k_slotn[] = "slotn";
  static const char __pyx_k_slots[] = "slots";
  static const char __pyx_k_split[] = "split";
  static const char __pyx_k_sub_2[] = "__sub__";
  static const char __pyx_k_super[] = "super";
  static const char __pyx_k_sympy[] = "sympy";
  static const char __pyx_k_tdlen[] = "tdlen";
  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_utf_8[] = "utf-8";
  static const char __pyx_k_value[] = "value";
  static const char __pyx_k_wedge[] = "{}^{\\wedge}";
  static const char __pyx_k_zfill[] = "zfill";
  static const char __pyx_k_Divide[] = "Divide";
  static const char __pyx_k_Failed[] = "$Failed";
  static const char __pyx_k_Global[] = "Global`";
  static const char __pyx_k_Number[] = "Number";
  static const char __pyx_k_RowBox[] = "RowBox";
  static const char __pyx_k_String[] = "String";
  static const char __pyx_k_Symbol[] = "Symbol";
  static const char __pyx_k_System[] = "System`";
  static const char __pyx_k_Thread[] = "Thread";
  static const char __pyx_k_append[] = "append";
  static const char __pyx_k_base64[] = "base64";
  static const char __pyx_k_bisect[] = "bisect";
  static const char __pyx_k_decode[] = "decode";
  static const char __pyx_k_digits[] = "digits";
  static const char __pyx_k_encode[] = "encode";
  static const char __pyx_k_equal2[] = "equal2";
  static const char __pyx_k_escape[] = "escape";
  static const char __pyx_k_extend[] = "extend";
  static const char __pyx_k_filter[] = "filter";
  static const char __pyx_k_format[] = "format";
  static const char __pyx_k_head_2[] = "_head";
  static const char __pyx_k_import[] = "__import__";
  static const char __pyx_k_kwargs[] = "kwargs";
  static const char __pyx_k_leaves[] = "leaves";
  static const char __pyx_k_left_s[] = "\\left%s";
  static const char __pyx_k_lstrip[] = "lstrip";
  static const char __pyx_k_module[] = "__module__";
  static const char __pyx_k_mpmath[] = "mpmath";
  static const char __pyx_k_msub_2[] = "</msub>";
  static const char __pyx_k_msup_2[] = "</msup>";
  static const char __pyx_k_n_expr[] = "n_expr";
  static const char __pyx_k_name_2[] = "__name__";
  static const char __pyx_k_object[] = "object";
  static const char __pyx_k_option[] = "option";
  static const char __pyx_k_parent[] = "parent";
  static const char __pyx_k_prec_2[] = "_prec";
  static const char __pyx_k_py_obj[] = "py_obj";
  static const char __pyx_k_render[] = "render";
  static const char __pyx_k_result[] = "result";
  static const char __pyx_k_return[] = "return";
  static const char __pyx_k_rindex[] = "rindex";
  static const char __pyx_k_setter[] = "setter";
  static const char __pyx_k_sliced[] = "sliced";
  static const char __pyx_k_sqrt_s[] = "\\sqrt{%s}";
  static const char __pyx_k_string[] = "string";
  static const char __pyx_k_text_s[] = "\\text{\"%s\"}";
  static const char __pyx_k_thread[] = "thread";
  static const char __pyx_k_typing[] = "typing";
  static const char __pyx_k_update[] = "update";
  static const char __pyx_k_values[] = "values";
  static const char __pyx_k_vert_2[] = "$\\vert$";
  static const char __pyx_k_Aborted[] = "$Aborted";
  static const char __pyx_k_Catalan[] = "Catalan";
  static const char __pyx_k_Complex[] = "Complex";
  static const char __pyx_k_Default[] = "Default";
  static const char __pyx_k_Integer[] = "Integer";
  static const char __pyx_k_SymbolN[] = "SymbolN";
  static const char __pyx_k_TeXForm[] = "TeXForm";
  static const char __pyx_k_abs_eps[] = "abs_eps";
  static const char __pyx_k_applied[] = "applied";
  static const char __pyx_k_builtin[] = "builtin";
  static const char __pyx_k_cache_2[] = "cache";
  static const char __pyx_k_compile[] = "compile";
  static const char __pyx_k_content[] = "content";
  static const char __pyx_k_context[] = "context";
  static const char __pyx_k_descend[] = "descend";
  static const char __pyx_k_do_copy[] = "do_copy";
  static const char __pyx_k_entries[] = "entries";
  static const char __pyx_k_findall[] = "findall";
  static const char __pyx_k_flatten[] = "flatten";
  static const char __pyx_k_formats[] = "formats";
  static const char __pyx_k_genexpr[] = "genexpr";
  static const char __pyx_k_in_text[] = "in_text";
  static const char __pyx_k_indices[] = "indices";
  static const char __pyx_k_is_atom[] = "is_atom";
  static const char __pyx_k_is_free[] = "is_free";
  static const char __pyx_k_is_true[] = "is_true";
  static const char __pyx_k_is_zero[] = "is_zero";
  static const char __pyx_k_maxsize[] = "maxsize";
  static const char __pyx_k_message[] = "message";
  static const char __pyx_k_mfrac_2[] = "</mfrac>";
  static const char __pyx_k_mi_s_mi[] = "<mi>%s</mi>";
  static const char __pyx_k_min_key[] = "min_key";
  static const char __pyx_k_mn_s_mn[] = "<mn>%s</mn>";
  static const char __pyx_k_mo_s_mo[] = "<mo>%s</mo>";
  static const char __pyx_k_modname[] = "modname";
  static const char __pyx_k_ms_s_ms[] = "<ms>%s</ms>";
  static const char __pyx_k_msubsup[] = "<msubsup>";
  static const char __pyx_k_newline[] = "\\newline\n";
  static const char __pyx_k_options[] = "options";
  static const char __pyx_k_origins[] = "origins";
  static const char __pyx_k_outtext[] = "outtext";
  static const char __pyx_k_pattern[] = "pattern";
  static const char __pyx_k_pos_len[] = "pos_len";
  static const char __pyx_k_prepare[] = "__prepare__";
  static const char __pyx_k_rel_eps[] = "rel_eps";
  static const char __pyx_k_replace[] = "replace";
  static const char __pyx_k_right_s[] = "\\right%s";
  static const char __pyx_k_symbols[] = "symbols";
  static const char __pyx_k_sympy_2[] = "sympy.";
  static const char __pyx_k_timeout[] = "timeout";
  static const char __pyx_k_truediv[] = "__truediv__";
  static const char __pyx_k_unicode[] = "unicode";
  static const char __pyx_k_wedge_2[] = "${}^{\\wedge}$";
  static const char __pyx_k_BoxError[] = "BoxError";
  static const char __pyx_k_Evaluate[] = "Evaluate";
  static const char __pyx_k_FullForm[] = "FullForm";
  static const char __pyx_k_Function[] = "Function";
  static const char __pyx_k_HoldForm[] = "HoldForm";
  static const char __pyx_k_Infinity[] = "Infinity";
  static const char __pyx_k_Integer0[] = "Integer0";
  static const char __pyx_k_Integer1[] = "Integer1";
  static const char __pyx_k_Monomial[] = "Monomial";
  static const char __pyx_k_Optional[] = "Optional";
  static const char __pyx_k_Rational[] = "Rational";
  static const char __pyx_k_Sequence[] = "Sequence";
  static const char __pyx_k_StyleBox[] = "StyleBox";
  static const char __pyx_k_Subtract[] = "Subtract";
  static const char __pyx_k_almosteq[] = "almosteq";
  static const char __pyx_k_builtins[] = "builtins";
  static const char __pyx_k_callback[] = "callback";
  static const char __pyx_k_compiled[] = "compiled";
  static const char __pyx_k_endswith[] = "endswith";
  static const char __pyx_k_evaluate[] = "evaluate";
  static const char __pyx_k_floordiv[] = "__floordiv__";
  static const char __pyx_k_get_head[] = "get_head";
  static const char __pyx_k_get_name[] = "get_name";
  static const char __pyx_k_get_type[] = "get_type";
  static const char __pyx_k_has_form[] = "has_form";
  static const char __pyx_k_is_style[] = "is_style";
  static const char __pyx_k_leaves_2[] = "_leaves";
  static const char __pyx_k_math_inf[] = "math.inf";
  static const char __pyx_k_min_prec[] = "min_prec";
  static const char __pyx_k_n_result[] = "n_result";
  static const char __pyx_k_new_leaf[] = "new_leaf";
  static const char __pyx_k_numerify[] = "numerify";
  static const char __pyx_k_operator[] = "operator";
  static const char __pyx_k_optimize[] = "optimize";
  static const char __pyx_k_original[] = "original";
  static const char __pyx_k_position[] = "position";
  static const char __pyx_k_property[] = "property";
  static const char __pyx_k_py_slice[] = "py_slice";
  static const char __pyx_k_qualname[] = "__qualname__";
  static const char __pyx_k_reversed[] = "reversed";
  static const char __pyx_k_self_exp[] = "self_exp";
  static const char __pyx_k_self_len[] = "self_len";
  static const char __pyx_k_self_var[] = "self_var";
  static const char __pyx_k_sequence[] = "sequence";
  static const char __pyx_k_set_head[] = "set_head";
  static const char __pyx_k_set_leaf[] = "set_leaf";
  static const char __pyx_k_sym_args[] = "sym_args";
  static const char __pyx_k_text_s_2[] = "\\text{%s}";
  static const char __pyx_k_threaded[] = "threaded";
  static const char __pyx_k_to_sympy[] = "to_sympy";
  static const char __pyx_k_workprec[] = "workprec";
  static const char __pyx_k_Atom_copy[] = "Atom.copy";
  static const char __pyx_k_ByteArray[] = "ByteArray";
  static const char __pyx_k_Complex_2[] = "Complex[";
  static const char __pyx_k_InputForm[] = "InputForm";
  static const char __pyx_k_MakeBoxes[] = "MakeBoxes";
  static const char __pyx_k_Real___eq[] = "Real.__eq__";
  static const char __pyx_k_Real___ne[] = "Real.__ne__";
  static const char __pyx_k_Structure[] = "Structure";
  static const char __pyx_k_TypeError[] = "TypeError";
  static const char __pyx_k_Undefined[] = "Undefined";
  static const char __pyx_k_b64decode[] = "b64decode";
  static const char __pyx_k_b64encode[] = "b64encode";
  static const char __pyx_k_backslash[] = "\\backslash{}";
  static const char __pyx_k_construct[] = "construct";
  static const char __pyx_k_direction[] = "direction";
  static const char __pyx_k_do_format[] = "do_format";
  static const char __pyx_k_enumerate[] = "enumerate";
  static const char __pyx_k_exps_dict[] = "exps_dict";
  static const char __pyx_k_flattened[] = "flattened";
  static const char __pyx_k_formatted[] = "formatted";
  static const char __pyx_k_functions[] = "functions";
  static const char __pyx_k_functools[] = "functools";
  static const char __pyx_k_get_atoms[] = "get_atoms";
  static const char __pyx_k_get_value[] = "get_value";
  static const char __pyx_k_head_name[] = "head_name";
  static const char __pyx_k_imag_prec[] = "imag_prec";
  static const char __pyx_k_imag_zero[] = "imag_zero";
  static const char __pyx_k_innerleaf[] = "innerleaf";
  static const char __pyx_k_is_symbol[] = "is_symbol";
  static const char __pyx_k_iteration[] = "iteration";
  static const char __pyx_k_itertools[] = "itertools";
  static const char __pyx_k_leaf_prec[] = "leaf_prec";
  static const char __pyx_k_left_left[] = "\\left[\\left[";
  static const char __pyx_k_levelspec[] = "levelspec";
  static const char __pyx_k_list_expr[] = "list_expr";
  static const char __pyx_k_lru_cache[] = "lru_cache";
  static const char __pyx_k_metaclass[] = "__metaclass__";
  static const char __pyx_k_msubsup_2[] = "</msubsup>";
  static const char __pyx_k_no_symbol[] = "_no_symbol";
  static const char __pyx_k_numerator[] = "numerator";
  static const char __pyx_k_operators[] = "operators";
  static const char __pyx_k_other_exp[] = "other_exp";
  static const char __pyx_k_other_len[] = "other_len";
  static const char __pyx_k_other_var[] = "other_var";
  static const char __pyx_k_real_prec[] = "real_prec";
  static const char __pyx_k_real_zero[] = "real_zero";
  static const char __pyx_k_reordered[] = "reordered";
  static const char __pyx_k_self_exps[] = "self_exps";
  static const char __pyx_k_sequences[] = "sequences";
  static const char __pyx_k_structure[] = "structure";
  static const char __pyx_k_sub_level[] = "sub_level";
  static const char __pyx_k_to_mpmath[] = "to_mpmath";
  static const char __pyx_k_to_python[] = "to_python";
  static const char __pyx_k_user_hash[] = "user_hash";
  static const char __pyx_k_0123456789[] = "0123456789-.";
  static const char __pyx_k_DigitBlock[] = "DigitBlock";
  static const char __pyx_k_EulerGamma[] = "EulerGamma";
  static const char __pyx_k_Expression[] = "Expression";
  static const char __pyx_k_MathMLForm[] = "MathMLForm";
  static const char __pyx_k_OutputForm[] = "OutputForm";
  static const char __pyx_k_Real___new[] = "Real.__new__";
  static const char __pyx_k_SymbolList[] = "SymbolList";
  static const char __pyx_k_SymbolNull[] = "SymbolNull";
  static const char __pyx_k_SymbolRule[] = "SymbolRule";
  static const char __pyx_k_SymbolTrue[] = "SymbolTrue";
  static const char __pyx_k_ValueError[] = "ValueError";
  static const char __pyx_k_apply_leaf[] = "apply_leaf";
  static const char __pyx_k_atom_names[] = "atom_names";
  static const char __pyx_k_attributes[] = "attributes";
  static const char __pyx_k_definition[] = "definition";
  static const char __pyx_k_do_flatten[] = "do_flatten";
  static const char __pyx_k_encode_tex[] = "encode_tex";
  static const char __pyx_k_eval_range[] = "eval_range";
  static const char __pyx_k_evaluation[] = "evaluation";
  static const char __pyx_k_get_leaves[] = "get_leaves";
  static const char __pyx_k_getnewargs[] = "__getnewargs__";
  static const char __pyx_k_has_symbol[] = "has_symbol";
  static const char __pyx_k_in_scoping[] = "in_scoping";
  static const char __pyx_k_inside_row[] = "inside_row";
  static const char __pyx_k_is_inexact[] = "is_inexact";
  static const char __pyx_k_is_numeric[] = "is_numeric";
  static const char __pyx_k_make_boxes[] = "make_boxes";
  static const char __pyx_k_new_leaves[] = "new_leaves";
  static const char __pyx_k_other_exps[] = "other_exps";
  static const char __pyx_k_precedence[] = "precedence";
  static const char __pyx_k_reevaluate[] = "reevaluate";
  static const char __pyx_k_rest_range[] = "rest_range";
  static const char __pyx_k_startswith[] = "startswith";
  static const char __pyx_k_sup_string[] = "sup_string";
  static const char __pyx_k_symbolname[] = "symbolname";
  static const char __pyx_k_sympy_expr[] = "sympy_expr";
  static const char __pyx_k_sympy_name[] = "sympy_name";
  static const char __pyx_k_Association[] = "Association";
  static const char __pyx_k_Atom___repr[] = "Atom.__repr__";
  static const char __pyx_k_Atom_equal2[] = "Atom.equal2";
  static const char __pyx_k_FractionBox[] = "FractionBox";
  static const char __pyx_k_GoldenRatio[] = "GoldenRatio";
  static const char __pyx_k_MachineReal[] = "MachineReal";
  static const char __pyx_k_NumberPoint[] = "NumberPoint";
  static const char __pyx_k_NumberSigns[] = "NumberSigns";
  static const char __pyx_k_Real___hash[] = "Real.__hash__";
  static const char __pyx_k_RuleDelayed[] = "RuleDelayed";
  static const char __pyx_k_SignPadding[] = "SignPadding";
  static const char __pyx_k_SymbolFalse[] = "SymbolFalse";
  static const char __pyx_k_System_Flat[] = "System`Flat";
  static const char __pyx_k_System_List[] = "System`List";
  static const char __pyx_k_System_Real[] = "System`Real>";
  static const char __pyx_k_System_Slot[] = "System`Slot";
  static const char __pyx_k_System_With[] = "System`With";
  static const char __pyx_k_TEX_REPLACE[] = "TEX_REPLACE";
  static const char __pyx_k_Unevaluated[] = "Unevaluated";
  static const char __pyx_k_apply_rules[] = "apply_rules";
  static const char __pyx_k_backslash_2[] = "$\\backslash$";
  static const char __pyx_k_bisect_left[] = "bisect_left";
  static const char __pyx_k_clear_cache[] = "clear_cache";
  static const char __pyx_k_defaultexpr[] = "defaultexpr";
  static const char __pyx_k_definitions[] = "definitions";
  static const char __pyx_k_denominator[] = "denominator";
  static const char __pyx_k_equal_heads[] = "equal_heads";
  static const char __pyx_k_expressions[] = "expressions";
  static const char __pyx_k_format_expr[] = "format_expr";
  static const char __pyx_k_from_mpmath[] = "from_mpmath";
  static const char __pyx_k_from_python[] = "from_python";
  static const char __pyx_k_func_params[] = "func_params";
  static const char __pyx_k_get_formats[] = "get_formats";
  static const char __pyx_k_get_options[] = "get_options";
  static const char __pyx_k_has_changed[] = "has_changed";
  static const char __pyx_k_in_function[] = "in_function";
  static const char __pyx_k_inside_list[] = "inside_list";
  static const char __pyx_k_is_constant[] = "is_constant";
  static const char __pyx_k_is_list_row[] = "is_list_row";
  static const char __pyx_k_leaf_counts[] = "leaf_counts";
  static const char __pyx_k_lookup_name[] = "lookup_name";
  static const char __pyx_k_mrow_s_mrow[] = "<mrow>%s</mrow>";
  static const char __pyx_k_new_applied[] = "new_applied";
  static const char __pyx_k_number_form[] = "number_form";
  static const char __pyx_k_number_type[] = "number_type";
  static const char __pyx_k_old_options[] = "old_options";
  static const char __pyx_k_only_subsup[] = "only_subsup";
  static const char __pyx_k_python_form[] = "python_form";
  static const char __pyx_k_replacement[] = "replacement";
  static const char __pyx_k_restructure[] = "restructure";
  static const char __pyx_k_right_right[] = "\\right]\\right]";
  static const char __pyx_k_rules_names[] = "rules_names";
  static const char __pyx_k_sequences_2[] = "_sequences";
  static const char __pyx_k_string_list[] = "string_list";
  static const char __pyx_k_sub_applied[] = "sub_applied";
  static const char __pyx_k_symbol_name[] = "symbol_name";
  static const char __pyx_k_sympy_dummy[] = "sympy_dummy";
  static const char __pyx_k_unevaluated[] = "unevaluated";
  static const char __pyx_k_unformatted[] = "unformatted";
  static const char __pyx_k_Atom_is_atom[] = "Atom.is_atom";
  static const char __pyx_k_BoxConstruct[] = "BoxConstruct";
  static const char __pyx_k_COMPARE_PREC[] = "COMPARE_PREC";
  static const char __pyx_k_Complex___eq[] = "Complex.__eq__";
  static const char __pyx_k_ExponentStep[] = "ExponentStep";
  static const char __pyx_k_Expression_s[] = "<Expression: %s>";
  static const char __pyx_k_NumberFormat[] = "_NumberFormat";
  static const char __pyx_k_NumberSymbol[] = "NumberSymbol";
  static const char __pyx_k_Number___str[] = "Number.__str__";
  static const char __pyx_k_Rational_s_s[] = "Rational[%s, %s]";
  static const char __pyx_k_SlotSequence[] = "SlotSequence";
  static const char __pyx_k_StandardForm[] = "StandardForm";
  static const char __pyx_k_String___new[] = "String.__new__";
  static const char __pyx_k_String___str[] = "String.__str__";
  static const char __pyx_k_String_sameQ[] = "String.sameQ";
  static const char __pyx_k_SymbolFailed[] = "SymbolFailed";
  static const char __pyx_k_Symbol___new[] = "Symbol.__new__";
  static const char __pyx_k_Symbol___str[] = "Symbol.__str__";
  static const char __pyx_k_Symbol_sameQ[] = "Symbol.sameQ";
  static const char __pyx_k_System_Blank[] = "System`Blank";
  static const char __pyx_k_System_Block[] = "System`Block";
  static const char __pyx_k_System_Times[] = "System`Times";
  static const char __pyx_k_boxes_to_tex[] = "boxes_to_tex";
  static const char __pyx_k_dirty_leaves[] = "dirty_leaves";
  static const char __pyx_k_encoded_text[] = "encoded_text";
  static const char __pyx_k_format_cache[] = "_format_cache";
  static const char __pyx_k_get_sequence[] = "get_sequence";
  static const char __pyx_k_get_sort_key[] = "get_sort_key";
  static const char __pyx_k_get_upvalues[] = "get_upvalues";
  static const char __pyx_k_include_form[] = "include_form";
  static const char __pyx_k_intersection[] = "intersection";
  static const char __pyx_k_item_is_free[] = "item_is_free";
  static const char __pyx_k_leaf_symbols[] = "leaf_symbols";
  static const char __pyx_k_message_args[] = "message_args";
  static const char __pyx_k_n_evaluation[] = "n_evaluation";
  static const char __pyx_k_pattern_only[] = "pattern_only";
  static const char __pyx_k_pattern_sort[] = "pattern_sort";
  static const char __pyx_k_replace_vars[] = "replace_vars";
  static const char __pyx_k_scoping_vars[] = "scoping_vars";
  static const char __pyx_k_shallow_copy[] = "shallow_copy";
  static const char __pyx_k_shorten_name[] = "shorten_name";
  static const char __pyx_k_staticmethod[] = "staticmethod";
  static const char __pyx_k_Atom_get_head[] = "Atom.get_head";
  static const char __pyx_k_Atom_has_form[] = "Atom.has_form";
  static const char __pyx_k_Atom_numerify[] = "Atom.numerify";
  static const char __pyx_k_ByteArrayAtom[] = "ByteArrayAtom";
  static const char __pyx_k_Complex___neg[] = "Complex.__neg__";
  static const char __pyx_k_Complex___new[] = "Complex.__new__";
  static const char __pyx_k_Complex___str[] = "Complex.__str__";
  static const char __pyx_k_Complex_round[] = "Complex.round";
  static const char __pyx_k_Complex_sameQ[] = "Complex.sameQ";
  static const char __pyx_k_Integer___neg[] = "Integer.__neg__";
  static const char __pyx_k_Integer___new[] = "Integer.__new__";
  static const char __pyx_k_Integer_round[] = "Integer.round";
  static const char __pyx_k_Integer_sameQ[] = "Integer.sameQ";
  static const char __pyx_k_KeyComparable[] = "KeyComparable";
  static const char __pyx_k_Monomial___eq[] = "Monomial.__eq__";
  static const char __pyx_k_Monomial___ge[] = "Monomial.__ge__";
  static const char __pyx_k_Monomial___gt[] = "Monomial.__gt__";
  static const char __pyx_k_Monomial___le[] = "Monomial.__le__";
  static const char __pyx_k_Monomial___lt[] = "Monomial.__lt__";
  static const char __pyx_k_Monomial___ne[] = "Monomial.__ne__";
  static const char __pyx_k_Monomial__cmp[] = "_Monomial__cmp";
  static const char __pyx_k_NumberPadding[] = "NumberPadding";
  static const char __pyx_k_OverflowError[] = "OverflowError";
  static const char __pyx_k_PrecisionReal[] = "PrecisionReal";
  static const char __pyx_k_Real_evaluate[] = "Real.evaluate";
  static const char __pyx_k_String___hash[] = "String.__hash__";
  static const char __pyx_k_SymbolAborted[] = "SymbolAborted";
  static const char __pyx_k_Symbol___hash[] = "Symbol.__hash__";
  static const char __pyx_k_Symbol_equal2[] = "Symbol.equal2";
  static const char __pyx_k_System_Module[] = "System`Module";
  static const char __pyx_k_System_RowBox[] = "System`RowBox";
  static const char __pyx_k_System_Symbol[] = "System`Symbol>";
  static const char __pyx_k_allow_symbols[] = "allow_symbols";
  static const char __pyx_k_atom_to_boxes[] = "atom_to_boxes";
  static const char __pyx_k_boxes_to_text[] = "boxes_to_text";
  static const char __pyx_k_check_stopped[] = "check_stopped";
  static const char __pyx_k_encode_mathml[] = "encode_mathml";
  static const char __pyx_k_evaluate_next[] = "evaluate_next";
  static const char __pyx_k_filter_leaves[] = "filter_leaves";
  static const char __pyx_k_get_atom_name[] = "get_atom_name";
  static const char __pyx_k_get_head_name[] = "get_head_name";
  static const char __pyx_k_get_int_value[] = "get_int_value";
  static const char __pyx_k_get_ownvalues[] = "get_ownvalues";
  static const char __pyx_k_get_precision[] = "get_precision";
  static const char __pyx_k_get_subvalues[] = "get_subvalues";
  static const char __pyx_k_include_heads[] = "include_heads";
  static const char __pyx_k_msqrt_s_msqrt[] = "<msqrt>%s</msqrt>";
  static const char __pyx_k_mtext_s_mtext[] = "<mtext>%s</mtext>";
  static const char __pyx_k_new_sequences[] = "new_sequences";
  static const char __pyx_k_option_values[] = "option_values";
  static const char __pyx_k_rebuild_cache[] = "_rebuild_cache";
  static const char __pyx_k_replace_slots[] = "replace_slots";
  static const char __pyx_k_set_positions[] = "set_positions";
  static const char __pyx_k_stop_on_error[] = "stop_on_error";
  static const char __pyx_k_string_quotes[] = "string_quotes";
  static const char __pyx_k_strip_context[] = "strip_context";
  static const char __pyx_k_Atom_get_atoms[] = "Atom.get_atoms";
  static const char __pyx_k_BaseExpression[] = "BaseExpression";
  static const char __pyx_k_Complex___hash[] = "Complex.__hash__";
  static const char __pyx_k_Integer___hash[] = "Integer.__hash__";
  static const char __pyx_k_Integer___init[] = "Integer.__init__";
  static const char __pyx_k_IterationLimit[] = "$IterationLimit";
  static const char __pyx_k_Monomial___cmp[] = "Monomial.__cmp";
  static const char __pyx_k_NumberFormat_2[] = "NumberFormat";
  static const char __pyx_k_Rational___neg[] = "Rational.__neg__";
  static const char __pyx_k_Rational___new[] = "Rational.__new__";
  static const char __pyx_k_Rational_round[] = "Rational.round";
  static const char __pyx_k_Rational_sameQ[] = "Rational.sameQ";
  static const char __pyx_k_Real_user_hash[] = "Real.user_hash";
  static const char __pyx_k_String_do_copy[] = "String.do_copy";
  static const char __pyx_k_SuperscriptBox[] = "SuperscriptBox";
  static const char __pyx_k_SymbolInfinity[] = "SymbolInfinity";
  static const char __pyx_k_SymbolSequence[] = "SymbolSequence";
  static const char __pyx_k_Symbol_do_copy[] = "Symbol.do_copy";
  static const char __pyx_k_Symbol_is_true[] = "Symbol.is_true";
  static const char __pyx_k_System_Compile[] = "System`Compile";
  static const char __pyx_k_System_Complex[] = "System`Complex>";
  static const char __pyx_k_System_HoldAll[] = "System`HoldAll";
  static const char __pyx_k_System_Integer[] = "System`Integer>";
  static const char __pyx_k_System_Pattern[] = "System`Pattern";
  static const char __pyx_k_System_Postfix[] = "System`Postfix";
  static const char __pyx_k_System_SqrtBox[] = "System`SqrtBox";
  static const char __pyx_k_System_TeXForm[] = "System`TeXForm";
  static const char __pyx_k_TEX_REPLACE_RE[] = "TEX_REPLACE_RE";
  static const char __pyx_k_as_numer_denom[] = "as_numer_denom";
  static const char __pyx_k_default_format[] = "default_format";
  static const char __pyx_k_ensure_context[] = "ensure_context";
  static const char __pyx_k_get_attributes[] = "get_attributes";
  static const char __pyx_k_get_definition[] = "get_definition";
  static const char __pyx_k_get_downvalues[] = "get_downvalues";
  static const char __pyx_k_get_rules_list[] = "get_rules_list";
  static const char __pyx_k_is_approx_zero[] = "is_approx_zero";
  static const char __pyx_k_is_symbol_name[] = "is_symbol_name";
  static const char __pyx_k_last_evaluated[] = "last_evaluated";
  static const char __pyx_k_only_if_exists[] = "only_if_exists";
  static const char __pyx_k_permit_complex[] = "permit_complex";
  static const char __pyx_k_round_to_float[] = "round_to_float";
  static const char __pyx_k_system_symbols[] = "system_symbols";
  static const char __pyx_k_Atom_has_symbol[] = "Atom.has_symbol";
  static const char __pyx_k_BoxError___init[] = "BoxError.__init__";
  static const char __pyx_k_ComplexInfinity[] = "ComplexInfinity";
  static const char __pyx_k_Complex_do_copy[] = "Complex.do_copy";
  static const char __pyx_k_Complex_is_zero[] = "Complex.is_zero";
  static const char __pyx_k_ExpressionCache[] = "ExpressionCache";
  static const char __pyx_k_Expression_copy[] = "Expression.copy";
  static const char __pyx_k_Expression_head[] = "Expression.head";
  static const char __pyx_k_Expression_sort[] = "Expression.sort";
  static const char __pyx_k_Integer_do_copy[] = "Integer.do_copy";
  static const char __pyx_k_Integer_is_zero[] = "Integer.is_zero";
  static const char __pyx_k_LinkedStructure[] = "LinkedStructure";
  static const char __pyx_k_Monomial___init[] = "Monomial.__init__";
  static const char __pyx_k_RationalOneHalf[] = "RationalOneHalf";
  static const char __pyx_k_Rational___hash[] = "Rational.__hash__";
  static const char __pyx_k_ReturnInterrupt[] = "ReturnInterrupt";
  static const char __pyx_k_String_to_sympy[] = "String.to_sympy";
  static const char __pyx_k_Structure_slice[] = "Structure.slice";
  static const char __pyx_k_SymbolByteArray[] = "SymbolByteArray";
  static const char __pyx_k_SymbolMakeBoxes[] = "SymbolMakeBoxes";
  static const char __pyx_k_SymbolUndefined[] = "SymbolUndefined";
  static const char __pyx_k_Symbol_evaluate[] = "Symbol.evaluate";
  static const char __pyx_k_Symbol_get_name[] = "Symbol.get_name";
  static const char __pyx_k_Symbol_to_sympy[] = "Symbol.to_sympy";
  static const char __pyx_k_SympyExpression[] = "SympyExpression";
  static const char __pyx_k_System_Evaluate[] = "System`Evaluate";
  static const char __pyx_k_System_FullForm[] = "System`FullForm";
  static const char __pyx_k_System_Function[] = "System`Function";
  static const char __pyx_k_System_GraphBox[] = "System`GraphBox";
  static const char __pyx_k_System_Graphics[] = "System`Graphics";
  static const char __pyx_k_System_HoldForm[] = "System`HoldForm";
  static const char __pyx_k_System_HoldRest[] = "System`HoldRest";
  static const char __pyx_k_System_Listable[] = "System`Listable";
  static const char __pyx_k_System_Optional[] = "System`Optional";
  static const char __pyx_k_System_Rational[] = "System`Rational>";
  static const char __pyx_k_System_Repeated[] = "System`Repeated";
  static const char __pyx_k_System_Sequence[] = "System`Sequence";
  static const char __pyx_k_System_Verbatim[] = "System`Verbatim";
  static const char __pyx_k_TraditionalForm[] = "TraditionalForm";
  static const char __pyx_k_boxes_to_mathml[] = "boxes_to_mathml";
  static const char __pyx_k_defined_symbols[] = "defined_symbols";
  static const char __pyx_k_evaluate_leaves[] = "evaluate_leaves";
  static const char __pyx_k_extra_operators[] = "extra_operators";
  static const char __pyx_k_full_atom_names[] = "full_atom_names";
  static const char __pyx_k_get_float_value[] = "get_float_value";
  static const char __pyx_k_get_lookup_name[] = "get_lookup_name";
  static const char __pyx_k_get_values_list[] = "get_values_list";
  static const char __pyx_k_is_neutral_head[] = "_is_neutral_head";
  static const char __pyx_k_mathics_builtin[] = "mathics.builtin";
  static const char __pyx_k_structure_cache[] = "structure_cache";
  static const char __pyx_k_timestamp_cache[] = "_timestamp_cache";
  static const char __pyx_k_Complex_evaluate[] = "Complex.evaluate";
  static const char __pyx_k_Complex_to_sympy[] = "Complex.to_sympy";
  static const char __pyx_k_DirectedInfinity[] = "DirectedInfinity";
  static const char __pyx_k_ExponentFunction[] = "_ExponentFunction";
  static const char __pyx_k_Expression___new[] = "Expression.__new__";
  static const char __pyx_k_Expression___str[] = "Expression.__str__";
  static const char __pyx_k_Expression_sameQ[] = "Expression.sameQ";
  static const char __pyx_k_Expression_slice[] = "Expression.slice";
  static const char __pyx_k_Integer_evaluate[] = "Integer.evaluate";
  static const char __pyx_k_Integer_to_sympy[] = "Integer.to_sympy";
  static const char __pyx_k_MachinePrecision[] = "MachinePrecision";
  static const char __pyx_k_NumberMultiplier[] = "NumberMultiplier";
  static const char __pyx_k_Rational_do_copy[] = "Rational.do_copy";
  static const char __pyx_k_Rational_is_zero[] = "Rational.is_zero";
  static const char __pyx_k_StringFromPython[] = "StringFromPython";
  static const char __pyx_k_String_to_python[] = "String.to_python";
  static const char __pyx_k_String_user_hash[] = "String.user_hash";
  static const char __pyx_k_Structure___call[] = "Structure.__call__";
  static const char __pyx_k_Structure_filter[] = "Structure.filter";
  static const char __pyx_k_Symbol_is_symbol[] = "Symbol.is_symbol";
  static const char __pyx_k_Symbol_to_python[] = "Symbol.to_python";
  static const char __pyx_k_Symbol_user_hash[] = "Symbol.user_hash";
  static const char __pyx_k_System_Condition[] = "System`Condition";
  static const char __pyx_k_System_HoldFirst[] = "System`HoldFirst";
  static const char __pyx_k_System_InputForm[] = "System`InputForm";
  static const char __pyx_k_System_Orderless[] = "System`Orderless";
  static const char __pyx_k_TEX_TEXT_REPLACE[] = "TEX_TEXT_REPLACE";
  static const char __pyx_k_flatten_callback[] = "flatten_callback";
  static const char __pyx_k_flatten_sequence[] = "_flatten_sequence";
  static const char __pyx_k_get_config_value[] = "get_config_value";
  static const char __pyx_k_get_scoping_vars[] = "get_scoping_vars";
  static const char __pyx_k_get_string_value[] = "get_string_value";
  static const char __pyx_k_is_list_interior[] = "is_list_interior";
  static const char __pyx_k_mathics_to_sympy[] = "mathics_to_sympy";
  static const char __pyx_k_outer_precedence[] = "outer_precedence";
  static const char __pyx_k_pattern_sequence[] = "pattern_sequence";
  static const char __pyx_k_Atom_get_sort_key[] = "Atom.get_sort_key";
  static const char __pyx_k_Atom_replace_vars[] = "Atom.replace_vars";
  static const char __pyx_k_Complex_do_format[] = "Complex.do_format";
  static const char __pyx_k_Complex_to_mpmath[] = "Complex.to_mpmath";
  static const char __pyx_k_Complex_to_python[] = "Complex.to_python";
  static const char __pyx_k_Complex_user_hash[] = "Complex.user_hash";
  static const char __pyx_k_ExpressionPointer[] = "ExpressionPointer";
  static const char __pyx_k_Expression___hash[] = "Expression.__hash__";
  static const char __pyx_k_Expression___repr[] = "Expression.__repr__";
  static const char __pyx_k_Expression_equal2[] = "Expression.equal2";
  static const char __pyx_k_Expression_filter[] = "Expression.filter";
  static const char __pyx_k_Expression_leaves[] = "Expression.leaves";
  static const char __pyx_k_Expression_thread[] = "Expression.thread";
  static const char __pyx_k_Integer_to_mpmath[] = "Integer.to_mpmath";
  static const char __pyx_k_Integer_to_python[] = "Integer.to_python";
  static const char __pyx_k_Integer_user_hash[] = "Integer.user_hash";
  static const char __pyx_k_MachineReal___neg[] = "MachineReal.__neg__";
  static const char __pyx_k_MachineReal___new[] = "MachineReal.__new__";
  static const char __pyx_k_MachineReal_round[] = "MachineReal.round";
  static const char __pyx_k_MachineReal_sameQ[] = "MachineReal.sameQ";
  static const char __pyx_k_Number_is_numeric[] = "Number.is_numeric";
  static const char __pyx_k_Rational_evaluate[] = "Rational.evaluate";
  static const char __pyx_k_Rational_to_sympy[] = "Rational.to_sympy";
  static const char __pyx_k_Real_boxes_to_tex[] = "Real.boxes_to_tex";
  static const char __pyx_k_Real_get_sort_key[] = "Real.get_sort_key";
  static const char __pyx_k_SymbolAssociation[] = "SymbolAssociation";
  static const char __pyx_k_Symbol_has_symbol[] = "Symbol.has_symbol";
  static const char __pyx_k_Symbol_is_numeric[] = "Symbol.is_numeric";
  static const char __pyx_k_System_Graphics3D[] = "System`Graphics3D";
  static const char __pyx_k_System_MathMLForm[] = "System`MathMLForm";
  static const char __pyx_k_System_NumberForm[] = "System`NumberForm";
  static const char __pyx_k_System_OutputForm[] = "System`OutputForm";
  static const char __pyx_k_UnlinkedStructure[] = "UnlinkedStructure";
  static const char __pyx_k_as_sympy_function[] = "_as_sympy_function";
  static const char __pyx_k_get_default_value[] = "get_default_value";
  static const char __pyx_k_get_option_values[] = "get_option_values";
  static const char __pyx_k_is_neutral_symbol[] = "_is_neutral_symbol";
  static const char __pyx_k_machine_precision[] = "machine_precision";
  static const char __pyx_k_mathics_to_python[] = "mathics_to_python";
  static const char __pyx_k_process_style_box[] = "process_style_box";
  static const char __pyx_k_Atom_atom_to_boxes[] = "Atom.atom_to_boxes";
  static const char __pyx_k_Atom_get_atom_name[] = "Atom.get_atom_name";
  static const char __pyx_k_Atom_replace_slots[] = "Atom.replace_slots";
  static const char __pyx_k_Atom_set_positions[] = "Atom.set_positions";
  static const char __pyx_k_ExponentFunction_2[] = "ExponentFunction";
  static const char __pyx_k_Expression_flatten[] = "Expression.flatten";
  static const char __pyx_k_Integer_make_boxes[] = "Integer.make_boxes";
  static const char __pyx_k_KeyComparable___eq[] = "KeyComparable.__eq__";
  static const char __pyx_k_KeyComparable___ge[] = "KeyComparable.__ge__";
  static const char __pyx_k_KeyComparable___gt[] = "KeyComparable.__gt__";
  static const char __pyx_k_KeyComparable___le[] = "KeyComparable.__le__";
  static const char __pyx_k_KeyComparable___lt[] = "KeyComparable.__lt__";
  static const char __pyx_k_KeyComparable___ne[] = "KeyComparable.__ne__";
  static const char __pyx_k_Rational_do_format[] = "Rational.do_format";
  static const char __pyx_k_Rational_numerator[] = "Rational.numerator";
  static const char __pyx_k_Rational_to_mpmath[] = "Rational.to_mpmath";
  static const char __pyx_k_Rational_to_python[] = "Rational.to_python";
  static const char __pyx_k_Rational_user_hash[] = "Rational.user_hash";
  static const char __pyx_k_Real_atom_to_boxes[] = "Real.atom_to_boxes";
  static const char __pyx_k_Real_boxes_to_text[] = "Real.boxes_to_text";
  static const char __pyx_k_Real_get_atom_name[] = "Real.get_atom_name";
  static const char __pyx_k_System_FractionBox[] = "System`FractionBox";
  static const char __pyx_k_System_PatternTest[] = "System`PatternTest";
  static const char __pyx_k_builtins_by_module[] = "builtins_by_module";
  static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
  static const char __pyx_k_flatten_sequence_2[] = "flatten_sequence";
  static const char __pyx_k_get_mutable_leaves[] = "get_mutable_leaves";
  static const char __pyx_k_mathics_core_rules[] = "mathics.core.rules";
  static const char __pyx_k_valid_context_name[] = "valid_context_name";
  static const char __pyx_k_ByteArrayAtom___new[] = "ByteArrayAtom.__new__";
  static const char __pyx_k_ByteArrayAtom___str[] = "ByteArrayAtom.__str__";
  static const char __pyx_k_ByteArrayAtom_sameQ[] = "ByteArrayAtom.sameQ";
  static const char __pyx_k_Expression_evaluate[] = "Expression.evaluate";
  static const char __pyx_k_Expression_get_head[] = "Expression.get_head";
  static const char __pyx_k_Expression_has_form[] = "Expression.has_form";
  static const char __pyx_k_Expression_numerify[] = "Expression.numerify";
  static const char __pyx_k_Expression_set_head[] = "Expression.set_head";
  static const char __pyx_k_Expression_set_leaf[] = "Expression.set_leaf";
  static const char __pyx_k_Expression_to_sympy[] = "Expression.to_sympy";
  static const char __pyx_k_MachineReal_do_copy[] = "MachineReal.do_copy";
  static const char __pyx_k_MachineReal_is_zero[] = "MachineReal.is_zero";
  static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
  static const char __pyx_k_PrecisionReal___neg[] = "PrecisionReal.__neg__";
  static const char __pyx_k_PrecisionReal___new[] = "PrecisionReal.__new__";
  static const char __pyx_k_PrecisionReal_round[] = "PrecisionReal.round";
  static const char __pyx_k_PrecisionReal_sameQ[] = "PrecisionReal.sameQ";
  static const char __pyx_k_String___getnewargs[] = "String.__getnewargs__";
  static const char __pyx_k_String_boxes_to_tex[] = "String.boxes_to_tex";
  static const char __pyx_k_String_get_sort_key[] = "String.get_sort_key";
  static const char __pyx_k_Symbol___getnewargs[] = "Symbol.__getnewargs__";
  static const char __pyx_k_Symbol_get_sort_key[] = "Symbol.get_sort_key";
  static const char __pyx_k_Symbol_replace_vars[] = "Symbol.replace_vars";
  static const char __pyx_k_System_Alternatives[] = "System`Alternatives";
  static const char __pyx_k_System_RepeatedNull[] = "System`RepeatedNull";
  static const char __pyx_k_System_SequenceHold[] = "System`SequenceHold";
  static const char __pyx_k_System_SlotSequence[] = "System`SlotSequence";
  static const char __pyx_k_System_StandardForm[] = "System`StandardForm";
  static const char __pyx_k_System_SubscriptBox[] = "System`SubscriptBox";
  static const char __pyx_k_Unknown_number_type[] = "Unknown number type: ";
  static const char __pyx_k_converted_functions[] = "converted_functions";
  static const char __pyx_k_dec_recursion_depth[] = "dec_recursion_depth";
  static const char __pyx_k_inc_recursion_depth[] = "inc_recursion_depth";
  static const char __pyx_k_mathics_core_parser[] = "mathics.core.parser";
  static const char __pyx_k_number_form_options[] = "_number_form_options";
  static const char __pyx_k_print_parenthesizes[] = "print_parenthesizes";
  static const char __pyx_k_sympy_symbol_prefix[] = "sympy_symbol_prefix";
  static const char __pyx_k_system_symbols_dict[] = "system_symbols_dict";
  static const char __pyx_k_BaseExpression___abs[] = "BaseExpression.__abs__";
  static const char __pyx_k_BaseExpression___add[] = "BaseExpression.__add__";
  static const char __pyx_k_BaseExpression___mul[] = "BaseExpression.__mul__";
  static const char __pyx_k_BaseExpression___neg[] = "BaseExpression.__neg__";
  static const char __pyx_k_BaseExpression___new[] = "BaseExpression.__new__";
  static const char __pyx_k_BaseExpression___pos[] = "BaseExpression.__pos__";
  static const char __pyx_k_BaseExpression___pow[] = "BaseExpression.__pow__";
  static const char __pyx_k_BaseExpression___sub[] = "BaseExpression.__sub__";
  static const char __pyx_k_BaseExpression_sameQ[] = "BaseExpression.sameQ";
  static const char __pyx_k_ByteArrayAtom___hash[] = "ByteArrayAtom.__hash__";
  static const char __pyx_k_Complex___getnewargs[] = "Complex.__getnewargs__";
  static const char __pyx_k_Complex_get_sort_key[] = "Complex.get_sort_key";
  static const char __pyx_k_ExpressionCache_copy[] = "ExpressionCache.copy";
  static const char __pyx_k_Expression_do_format[] = "Expression.do_format";
  static const char __pyx_k_Expression_get_atoms[] = "Expression.get_atoms";
  static const char __pyx_k_Expression_sequences[] = "Expression.sequences";
  static const char __pyx_k_Expression_to_python[] = "Expression.to_python";
  static const char __pyx_k_Expression_user_hash[] = "Expression.user_hash";
  static const char __pyx_k_Integer___getnewargs[] = "Integer.__getnewargs__";
  static const char __pyx_k_Integer_boxes_to_tex[] = "Integer.boxes_to_tex";
  static const char __pyx_k_Integer_get_sort_key[] = "Integer.get_sort_key";
  static const char __pyx_k_MachineReal_to_sympy[] = "MachineReal.to_sympy";
  static const char __pyx_k_Rational_denominator[] = "Rational.denominator";
  static const char __pyx_k_Real_boxes_to_mathml[] = "Real.boxes_to_mathml";
  static const char __pyx_k_String_atom_to_boxes[] = "String.atom_to_boxes";
  static const char __pyx_k_String_boxes_to_text[] = "String.boxes_to_text";
  static const char __pyx_k_Symbol_atom_to_boxes[] = "Symbol.atom_to_boxes";
  static const char __pyx_k_Symbol_boxes_to_text[] = "Symbol.boxes_to_text";
  static const char __pyx_k_System_BlankSequence[] = "System`BlankSequence";
  static const char __pyx_k_System_DefaultValues[] = "System`DefaultValues";
  static const char __pyx_k_get_operator_display[] = "get_operator_display";
  static const char __pyx_k_is_machine_precision[] = "is_machine_precision";
  static const char __pyx_k_mathics_builtin_base[] = "mathics.builtin.base";
  static const char __pyx_k_mathics_core_convert[] = "mathics.core.convert";
  static const char __pyx_k_mathics_core_numbers[] = "mathics.core.numbers";
  static const char __pyx_k_set_reordered_leaves[] = "set_reordered_leaves";
  static const char __pyx_k_BaseExpression___hash[] = "BaseExpression.__hash__";
  static const char __pyx_k_BaseExpression_equal2[] = "BaseExpression.equal2";
  static const char __pyx_k_BaseExpression_format[] = "BaseExpression.format";
  static const char __pyx_k_ByteArrayAtom_do_copy[] = "ByteArrayAtom.do_copy";
  static const char __pyx_k_Complex_atom_to_boxes[] = "Complex.atom_to_boxes";
  static const char __pyx_k_Complex_get_precision[] = "Complex.get_precision";
  static const char __pyx_k_ExpressionCache_union[] = "ExpressionCache.union";
  static const char __pyx_k_Expression__no_symbol[] = "Expression._no_symbol";
  static const char __pyx_k_Expression_get_leaves[] = "Expression.get_leaves";
  static const char __pyx_k_Expression_has_symbol[] = "Expression.has_symbol";
  static const char __pyx_k_Expression_is_numeric[] = "Expression.is_numeric";
  static const char __pyx_k_Integer_atom_to_boxes[] = "Integer.atom_to_boxes";
  static const char __pyx_k_Integer_boxes_to_text[] = "Integer.boxes_to_text";
  static const char __pyx_k_Integer_get_int_value[] = "Integer.get_int_value";
  static const char __pyx_k_LinkedStructure_slice[] = "LinkedStructure.slice";
  static const char __pyx_k_MachineReal_to_mpmath[] = "MachineReal.to_mpmath";
  static const char __pyx_k_MachineReal_to_python[] = "MachineReal.to_python";
  static const char __pyx_k_PrecisionReal_do_copy[] = "PrecisionReal.do_copy";
  static const char __pyx_k_PrecisionReal_is_zero[] = "PrecisionReal.is_zero";
  static const char __pyx_k_Rational___getnewargs[] = "Rational.__getnewargs__";
  static const char __pyx_k_Rational_get_sort_key[] = "Rational.get_sort_key";
  static const char __pyx_k_String_default_format[] = "String.default_format";
  static const char __pyx_k_SymbolComplexInfinity[] = "SymbolComplexInfinity";
  static const char __pyx_k_Symbol_default_format[] = "Symbol.default_format";
  static const char __pyx_k_Symbol_get_attributes[] = "Symbol.get_attributes";
  static const char __pyx_k_System_OptionsPattern[] = "System`OptionsPattern";
  static const char __pyx_k_System_SuperscriptBox[] = "System`SuperscriptBox";
  static const char __pyx_k_atom_list_constructor[] = "atom_list_constructor";
  static const char __pyx_k_mathics_builtin_inout[] = "mathics.builtin.inout";
  static const char __pyx_k_BaseExpression_flatten[] = "BaseExpression.flatten";
  static const char __pyx_k_BaseExpression_is_atom[] = "BaseExpression.is_atom";
  static const char __pyx_k_BaseExpression_is_free[] = "BaseExpression.is_free";
  static const char __pyx_k_BaseExpression_is_true[] = "BaseExpression.is_true";
  static const char __pyx_k_ByteArrayAtom_to_sympy[] = "ByteArrayAtom.to_sympy";
  static const char __pyx_k_Complex_default_format[] = "Complex.default_format";
  static const char __pyx_k_Complex_is_approx_zero[] = "Complex.is_approx_zero";
  static const char __pyx_k_ExpressionCache___init[] = "ExpressionCache.__init__";
  static const char __pyx_k_ExpressionCache_sliced[] = "ExpressionCache.sliced";
  static const char __pyx_k_Expression_apply_rules[] = "Expression.apply_rules";
  static const char __pyx_k_Expression_has_changed[] = "Expression.has_changed";
  static const char __pyx_k_Expression_restructure[] = "Expression.restructure";
  static const char __pyx_k_Integer_default_format[] = "Integer.default_format";
  static const char __pyx_k_LinkedStructure___call[] = "LinkedStructure.__call__";
  static const char __pyx_k_LinkedStructure___init[] = "LinkedStructure.__init__";
  static const char __pyx_k_LinkedStructure_filter[] = "LinkedStructure.filter";
  static const char __pyx_k_MachineReal_make_boxes[] = "MachineReal.make_boxes";
  static const char __pyx_k_PrecisionReal_to_sympy[] = "PrecisionReal.to_sympy";
  static const char __pyx_k_Rational_atom_to_boxes[] = "Rational.atom_to_boxes";
  static const char __pyx_k_StringFromPython___new[] = "StringFromPython.__new__";
  static const char __pyx_k_String_boxes_to_mathml[] = "String.boxes_to_mathml";
  static const char __pyx_k_SymbolDirectedInfinity[] = "SymbolDirectedInfinity";
  static const char __pyx_k_System_HoldAllComplete[] = "System`HoldAllComplete";
  static const char __pyx_k_cannot_be_formatted_as[] = " cannot be formatted as ";
  static const char __pyx_k_image_size_multipliers[] = "image_size_multipliers";
  static const char __pyx_k_show_string_characters[] = "show_string_characters";
  static const char __pyx_k_BaseExpression_evaluate[] = "BaseExpression.evaluate";
  static const char __pyx_k_BaseExpression_get_head[] = "BaseExpression.get_head";
  static const char __pyx_k_BaseExpression_get_name[] = "BaseExpression.get_name";
  static const char __pyx_k_BaseExpression_has_form[] = "BaseExpression.has_form";
  static const char __pyx_k_BaseExpression_to_sympy[] = "BaseExpression.to_sympy";
  static const char __pyx_k_ByteArrayAtom_to_python[] = "ByteArrayAtom.to_python";
  static const char __pyx_k_ByteArrayAtom_user_hash[] = "ByteArrayAtom.user_hash";
  static const char __pyx_k_Complex_get_float_value[] = "Complex.get_float_value";
  static const char __pyx_k_ExpressionPointer___str[] = "ExpressionPointer.__str__";
  static const char __pyx_k_Expression___getnewargs[] = "Expression.__getnewargs__";
  static const char __pyx_k_Expression_boxes_to_tex[] = "Expression.boxes_to_tex";
  static const char __pyx_k_Expression_get_sort_key[] = "Expression.get_sort_key";
  static const char __pyx_k_Expression_replace_vars[] = "Expression.replace_vars";
  static const char __pyx_k_Expression_shallow_copy[] = "Expression.shallow_copy";
  static const char __pyx_k_Integer_boxes_to_mathml[] = "Integer.boxes_to_mathml";
  static const char __pyx_k_PrecisionReal_to_mpmath[] = "PrecisionReal.to_mpmath";
  static const char __pyx_k_PrecisionReal_to_python[] = "PrecisionReal.to_python";
  static const char __pyx_k_Rational_default_format[] = "Rational.default_format";
  static const char __pyx_k_String_get_string_value[] = "String.get_string_value";
  static const char __pyx_k_System_CompiledFunction[] = "System`CompiledFunction";
  static const char __pyx_k_System_DirectedInfinity[] = "System`DirectedInfinity";
  static const char __pyx_k_UnlinkedStructure_slice[] = "UnlinkedStructure.slice";
  static const char __pyx_k_allow_initial_backquote[] = "allow_initial_backquote";
  static const char __pyx_k_mathics_builtin_scoping[] = "mathics.builtin.scoping";
  static const char __pyx_k_mathics_core_evaluation[] = "mathics.core.evaluation";
  static const char __pyx_k_mathics_core_expression[] = "mathics.core.expression";
  static const char __pyx_k_parenthesize_when_equal[] = "parenthesize_when_equal";
  static const char __pyx_k_BaseExpression___truediv[] = "BaseExpression.__truediv__";
  static const char __pyx_k_BaseExpression_do_format[] = "BaseExpression.do_format";
  static const char __pyx_k_BaseExpression_get_atoms[] = "BaseExpression.get_atoms";
  static const char __pyx_k_BaseExpression_is_symbol[] = "BaseExpression.is_symbol";
  static const char __pyx_k_BaseExpression_sequences[] = "BaseExpression.sequences";
  static const char __pyx_k_BaseExpression_to_mpmath[] = "BaseExpression.to_mpmath";
  static const char __pyx_k_BaseExpression_user_hash[] = "BaseExpression.user_hash";
  static const char __pyx_k_ExpressionPointer___init[] = "ExpressionPointer.__init__";
  static const char __pyx_k_Expression_boxes_to_text[] = "Expression.boxes_to_text";
  static const char __pyx_k_Expression_evaluate_next[] = "Expression.evaluate_next";
  static const char __pyx_k_Expression_filter_leaves[] = "Expression.filter_leaves";
  static const char __pyx_k_Expression_replace_slots[] = "Expression.replace_slots";
  static const char __pyx_k_Expression_set_positions[] = "Expression.set_positions";
  static const char __pyx_k_MachineReal___getnewargs[] = "MachineReal.__getnewargs__";
  static const char __pyx_k_PrecisionReal_make_boxes[] = "PrecisionReal.make_boxes";
  static const char __pyx_k_System_BlankNullSequence[] = "System`BlankNullSequence";
  static const char __pyx_k_System_SubsuperscriptBox[] = "System`SubsuperscriptBox";
  static const char __pyx_k_UnlinkedStructure___call[] = "UnlinkedStructure.__call__";
  static const char __pyx_k_UnlinkedStructure___init[] = "UnlinkedStructure.__init__";
  static const char __pyx_k_UnlinkedStructure_filter[] = "UnlinkedStructure.filter";
  static const char __pyx_k_flatten_pattern_sequence[] = "flatten_pattern_sequence";
  static const char __pyx_k_mathics_builtin_patterns[] = "mathics.builtin.patterns";
  static const char __pyx_k_mspace_linebreak_newline[] = "<mspace linebreak=\"newline\" />";
  static const char __pyx_k_BaseExpression___floordiv[] = "BaseExpression.__floordiv__";
  static const char __pyx_k_BaseExpression_get_leaves[] = "BaseExpression.get_leaves";
  static const char __pyx_k_BaseExpression_is_inexact[] = "BaseExpression.is_inexact";
  static const char __pyx_k_BaseExpression_is_numeric[] = "BaseExpression.is_numeric";
  static const char __pyx_k_ExpressionCache_reordered[] = "ExpressionCache.reordered";
  static const char __pyx_k_ExpressionPointer_replace[] = "ExpressionPointer.replace";
  static const char __pyx_k_Expression__rebuild_cache[] = "Expression._rebuild_cache";
  static const char __pyx_k_Expression_default_format[] = "Expression.default_format";
  static const char __pyx_k_Expression_get_attributes[] = "Expression.get_attributes";
  static const char __pyx_k_MachineReal_get_precision[] = "MachineReal.get_precision";
  static const char __pyx_k_encode_tex_locals_replace[] = "encode_tex.<locals>.replace";
  static const char __pyx_k_BaseExpression_apply_rules[] = "BaseExpression.apply_rules";
  static const char __pyx_k_BaseExpression_clear_cache[] = "BaseExpression.clear_cache";
  static const char __pyx_k_BaseExpression_has_changed[] = "BaseExpression.has_changed";
  static const char __pyx_k_ByteArrayAtom___getnewargs[] = "ByteArrayAtom.__getnewargs__";
  static const char __pyx_k_ByteArrayAtom_boxes_to_tex[] = "ByteArrayAtom.boxes_to_tex";
  static const char __pyx_k_ByteArrayAtom_get_sort_key[] = "ByteArrayAtom.get_sort_key";
  static const char __pyx_k_Expression_boxes_to_mathml[] = "Expression.boxes_to_mathml";
  static const char __pyx_k_Expression_evaluate_leaves[] = "Expression.evaluate_leaves";
  static const char __pyx_k_Expression_get_lookup_name[] = "Expression.get_lookup_name";
  static const char __pyx_k_KeyComparable_get_sort_key[] = "KeyComparable.get_sort_key";
  static const char __pyx_k_MachineReal_is_approx_zero[] = "MachineReal.is_approx_zero";
  static const char __pyx_k_PrecisionReal___getnewargs[] = "PrecisionReal.__getnewargs__";
  static const char __pyx_k_mathics_core_expression_py[] = "mathics/core/expression.py";
  static const char __pyx_k_BaseExpression_get_sequence[] = "BaseExpression.get_sequence";
  static const char __pyx_k_ByteArrayAtom_atom_to_boxes[] = "ByteArrayAtom.atom_to_boxes";
  static const char __pyx_k_ByteArrayAtom_boxes_to_text[] = "ByteArrayAtom.boxes_to_text";
  static const char __pyx_k_Expression__timestamp_cache[] = "Expression._timestamp_cache";
  static const char __pyx_k_Expression_flatten_sequence[] = "Expression.flatten_sequence";
  static const char __pyx_k_MachineReal_get_float_value[] = "MachineReal.get_float_value";
  static const char __pyx_k_PrecisionReal_get_precision[] = "PrecisionReal.get_precision";
  static const char __pyx_k_System_ImageSizeMultipliers[] = "System`ImageSizeMultipliers";
  static const char __pyx_k_System_ShowStringCharacters[] = "System`ShowStringCharacters";
  static const char __pyx_k_fully_qualified_symbol_name[] = "fully_qualified_symbol_name";
  static const char __pyx_k_BaseExpression_evaluate_next[] = "BaseExpression.evaluate_next";
  static const char __pyx_k_BaseExpression_get_head_name[] = "BaseExpression.get_head_name";
  static const char __pyx_k_BaseExpression_get_int_value[] = "BaseExpression.get_int_value";
  static const char __pyx_k_BaseExpression_get_precision[] = "BaseExpression.get_precision";
  static const char __pyx_k_ByteArrayAtom_default_format[] = "ByteArrayAtom.default_format";
  static const char __pyx_k_Complex_is_machine_precision[] = "Complex.is_machine_precision";
  static const char __pyx_k_Expression__flatten_sequence[] = "Expression._flatten_sequence";
  static const char __pyx_k_Expression_process_style_box[] = "Expression.process_style_box";
  static const char __pyx_k_convert_all_global_functions[] = "convert_all_global_functions";
  static const char __pyx_k_BaseExpression_get_attributes[] = "BaseExpression.get_attributes";
  static const char __pyx_k_BaseExpression_get_rules_list[] = "BaseExpression.get_rules_list";
  static const char __pyx_k_BaseExpression_round_to_float[] = "BaseExpression.round_to_float";
  static const char __pyx_k_ByteArrayAtom_boxes_to_mathml[] = "ByteArrayAtom.boxes_to_mathml";
  static const char __pyx_k_Expression__as_sympy_function[] = "Expression._as_sympy_function";
  static const char __pyx_k_Expression_get_mutable_leaves[] = "Expression.get_mutable_leaves";
  static const char __pyx_k_Expression_sort_locals_lambda[] = "Expression.sort.<locals>.<lambda>";
  static const char __pyx_k_Monomial___cmp_locals_genexpr[] = "Monomial.__cmp.<locals>.genexpr";
  static const char __pyx_k_BaseExpression_evaluate_leaves[] = "BaseExpression.evaluate_leaves";
  static const char __pyx_k_BaseExpression_get_float_value[] = "BaseExpression.get_float_value";
  static const char __pyx_k_BaseExpression_get_lookup_name[] = "BaseExpression.get_lookup_name";
  static const char __pyx_k_ByteArrayAtom_get_string_value[] = "ByteArrayAtom.get_string_value";
  static const char __pyx_k_Expression_copy_locals_genexpr[] = "Expression.copy.<locals>.genexpr";
  static const char __pyx_k_mo_form_prefix_lspace_0_rspace[] = "<mo form=\"prefix\" lspace=\"0\" rspace=\"0.2em\">%s</mo>";
  static const char __pyx_k_An_object_to_sort_monomials_use[] = "\n    An object to sort monomials, used in Expression.get_sort_key and\n    Symbol.get_sort_key.\n    ";
  static const char __pyx_k_Arbitrary_precision_real_number[] = "\n    Arbitrary precision real number.\n\n    Stored internally as a sympy.Float.\n\n    Note: Plays nicely with the mpmath.mpf (float) type.\n    ";
  static const char __pyx_k_BaseExpression_do_format_locals[] = "BaseExpression.do_format.<locals>.format_expr";
  static const char __pyx_k_BaseExpression_flatten_sequence[] = "BaseExpression.flatten_sequence";
  static const char __pyx_k_BaseExpression_get_string_value[] = "BaseExpression.get_string_value";
  static const char __pyx_k_Complex_wraps_two_real_valued_N[] = "\n    Complex wraps two real-valued Numbers.\n    ";
  static const char __pyx_k_Expression_evaluate_next_locals[] = "Expression.evaluate_next.<locals>.rules";
  static const char __pyx_k_Expression_set_reordered_leaves[] = "Expression.set_reordered_leaves";
  static const char __pyx_k_Machine_precision_real_number_S[] = "\n    Machine precision real number.\n\n    Stored internally as a python float.\n    ";
  static const char __pyx_k_is_neutral_symbol_locals_genexp[] = "_is_neutral_symbol.<locals>.genexpr";
  static const char __pyx_k_mo_form_prefix_lspace_0_2em_rsp[] = "<mo form=\"prefix\" lspace=\"0.2em\" rspace=\"0\">%s</mo>";
  static const char __pyx_k_Argument_imag_must_be_a_real_num[] = "Argument 'imag' must be a real number.";
  static const char __pyx_k_Argument_real_must_be_a_real_num[] = "Argument 'real' must be a real number.";
  static const char __pyx_k_BaseExpression_flatten_pattern_s[] = "BaseExpression.flatten_pattern_sequence";
  static const char __pyx_k_BaseExpression_get_option_values[] = "BaseExpression.get_option_values";
  static const char __pyx_k_BaseExpression_is_machine_precis[] = "BaseExpression.is_machine_precision";
  static const char __pyx_k_ExpressionCache_sliced_locals_ge[] = "ExpressionCache.sliced.<locals>.genexpr";
  static const char __pyx_k_Expression___new___locals_genexp[] = "Expression.__new__.<locals>.genexpr";
  static const char __pyx_k_Expression_apply_rules_locals_ap[] = "Expression.apply_rules.<locals>.apply_leaf";
  static const char __pyx_k_Expression_apply_rules_locals_de[] = "Expression.apply_rules.<locals>.descend";
  static const char __pyx_k_Expression_boxes_to_mathml_local[] = "Expression.boxes_to_mathml.<locals>.is_list_interior.<locals>.genexpr";
  static const char __pyx_k_Expression_boxes_to_tex_locals_b[] = "Expression.boxes_to_tex.<locals>.block";
  static const char __pyx_k_Expression_flatten_pattern_seque[] = "Expression.flatten_pattern_sequence.<locals>.sequence";
  static const char __pyx_k_Expression_flatten_sequence_loca[] = "Expression.flatten_sequence.<locals>.sequence";
  static const char __pyx_k_Expression_get_attributes_locals[] = "Expression.get_attributes.<locals>.genexpr";
  static const char __pyx_k_Expression_get_sort_key_locals_g[] = "Expression.get_sort_key.<locals>.genexpr";
  static const char __pyx_k_Expression_has_symbol_locals_gen[] = "Expression.has_symbol.<locals>.genexpr";
  static const char __pyx_k_Expression_head_is_write_protect[] = "Expression.head is write protected.";
  static const char __pyx_k_Expression_is_numeric_locals_gen[] = "Expression.is_numeric.<locals>.genexpr";
  static const char __pyx_k_Expression_leaves_is_write_prote[] = "Expression.leaves is write protected.";
  static const char __pyx_k_Expression_replace_vars_locals_g[] = "Expression.replace_vars.<locals>.genexpr";
  static const char __pyx_k_MachineReal_is_machine_precision[] = "MachineReal.is_machine_precision";
  static const char __pyx_k_String_boxes_to_mathml_locals_re[] = "String.boxes_to_mathml.<locals>.render";
  static const char __pyx_k_String_boxes_to_tex_locals_rende[] = "String.boxes_to_tex.<locals>.render";
  static const char __pyx_k_Structure_slice_only_supports_sl[] = "Structure.slice only supports slice steps of 1";
  static const char __pyx_k_Symbol_replace_vars_locals_genex[] = "Symbol.replace_vars.<locals>.genexpr";
  static const char __pyx_k_atom_list_constructor_locals_con[] = "atom_list_constructor.<locals>.construct";
  static const char __pyx_k_atom_list_constructor_locals_gen[] = "atom_list_constructor.<locals>.genexpr";
  static const char __pyx_k_expected_Expression_Structure_tu[] = "expected Expression, Structure, tuple or list as orig param";
  static const char __pyx_k_value_does_not_belongs_to_a_vali[] = "value does not belongs to a valid type";
  static const char __pyx_k_Expression_evaluate_next_locals_2[] = "Expression.evaluate_next.<locals>.rest_range";
  static const char __pyx_k_Expression_evaluate_next_locals_3[] = "Expression.evaluate_next.<locals>.eval_range";
  static const char __pyx_k_Expression_evaluate_next_locals_4[] = "Expression.evaluate_next.<locals>.flatten_callback";
  static const char __pyx_k_Expression_boxes_to_mathml_local_2[] = "Expression.boxes_to_mathml.<locals>.is_list_interior";
  static const char __pyx_k_Expression_flatten_pattern_seque_2[] = "Expression.flatten_pattern_sequence";
  static PyObject *__pyx_kp_u_;
  static PyObject *__pyx_kp_u_0;
  static PyObject *__pyx_kp_u_0123456789;
  static PyObject *__pyx_kp_u_0_2;
  static PyObject *__pyx_kp_u_0_9;
  static PyObject *__pyx_kp_u_9;
  static PyObject *__pyx_kp_u_Aborted;
  static PyObject *__pyx_n_u_Abs;
  static PyObject *__pyx_kp_s_An_object_to_sort_monomials_use;
  static PyObject *__pyx_n_s_Any;
  static PyObject *__pyx_kp_s_Arbitrary_precision_real_number;
  static PyObject *__pyx_kp_u_Argument_imag_must_be_a_real_num;
  static PyObject *__pyx_kp_u_Argument_real_must_be_a_real_num;
  static PyObject *__pyx_n_u_Association;
  static PyObject *__pyx_n_s_Atom;
  static PyObject *__pyx_n_u_Atom;
  static PyObject *__pyx_n_s_Atom___repr;
  static PyObject *__pyx_n_s_Atom_atom_to_boxes;
  static PyObject *__pyx_n_s_Atom_copy;
  static PyObject *__pyx_n_s_Atom_equal2;
  static PyObject *__pyx_n_s_Atom_get_atom_name;
  static PyObject *__pyx_n_s_Atom_get_atoms;
  static PyObject *__pyx_n_s_Atom_get_head;
  static PyObject *__pyx_n_s_Atom_get_sort_key;
  static PyObject *__pyx_n_s_Atom_has_form;
  static PyObject *__pyx_n_s_Atom_has_symbol;
  static PyObject *__pyx_n_s_Atom_is_atom;
  static PyObject *__pyx_n_s_Atom_numerify;
  static PyObject *__pyx_n_s_Atom_replace_slots;
  static PyObject *__pyx_n_s_Atom_replace_vars;
  static PyObject *__pyx_n_s_Atom_set_positions;
  static PyObject *__pyx_n_s_BaseExpression;
  static PyObject *__pyx_n_u_BaseExpression;
  static PyObject *__pyx_n_s_BaseExpression___abs;
  static PyObject *__pyx_n_s_BaseExpression___add;
  static PyObject *__pyx_n_s_BaseExpression___floordiv;
  static PyObject *__pyx_n_s_BaseExpression___hash;
  static PyObject *__pyx_n_s_BaseExpression___mul;
  static PyObject *__pyx_n_s_BaseExpression___neg;
  static PyObject *__pyx_n_s_BaseExpression___new;
  static PyObject *__pyx_n_s_BaseExpression___pos;
  static PyObject *__pyx_n_s_BaseExpression___pow;
  static PyObject *__pyx_n_s_BaseExpression___sub;
  static PyObject *__pyx_n_s_BaseExpression___truediv;
  static PyObject *__pyx_n_s_BaseExpression_apply_rules;
  static PyObject *__pyx_n_s_BaseExpression_clear_cache;
  static PyObject *__pyx_n_s_BaseExpression_do_format;
  static PyObject *__pyx_n_s_BaseExpression_do_format_locals;
  static PyObject *__pyx_n_s_BaseExpression_equal2;
  static PyObject *__pyx_n_s_BaseExpression_evaluate;
  static PyObject *__pyx_n_s_BaseExpression_evaluate_leaves;
  static PyObject *__pyx_n_s_BaseExpression_evaluate_next;
  static PyObject *__pyx_n_s_BaseExpression_flatten;
  static PyObject *__pyx_n_s_BaseExpression_flatten_pattern_s;
  static PyObject *__pyx_n_s_BaseExpression_flatten_sequence;
  static PyObject *__pyx_n_s_BaseExpression_format;
  static PyObject *__pyx_n_s_BaseExpression_get_atoms;
  static PyObject *__pyx_n_s_BaseExpression_get_attributes;
  static PyObject *__pyx_n_s_BaseExpression_get_float_value;
  static PyObject *__pyx_n_s_BaseExpression_get_head;
  static PyObject *__pyx_n_s_BaseExpression_get_head_name;
  static PyObject *__pyx_n_s_BaseExpression_get_int_value;
  static PyObject *__pyx_n_s_BaseExpression_get_leaves;
  static PyObject *__pyx_n_s_BaseExpression_get_lookup_name;
  static PyObject *__pyx_n_s_BaseExpression_get_name;
  static PyObject *__pyx_n_s_BaseExpression_get_option_values;
  static PyObject *__pyx_n_s_BaseExpression_get_precision;
  static PyObject *__pyx_n_s_BaseExpression_get_rules_list;
  static PyObject *__pyx_n_s_BaseExpression_get_sequence;
  static PyObject *__pyx_n_s_BaseExpression_get_string_value;
  static PyObject *__pyx_n_s_BaseExpression_has_changed;
  static PyObject *__pyx_n_s_BaseExpression_has_form;
  static PyObject *__pyx_n_s_BaseExpression_is_atom;
  static PyObject *__pyx_n_s_BaseExpression_is_free;
  static PyObject *__pyx_n_s_BaseExpression_is_inexact;
  static PyObject *__pyx_n_s_BaseExpression_is_machine_precis;
  static PyObject *__pyx_n_s_BaseExpression_is_numeric;
  static PyObject *__pyx_n_s_BaseExpression_is_symbol;
  static PyObject *__pyx_n_s_BaseExpression_is_true;
  static PyObject *__pyx_n_s_BaseExpression_round_to_float;
  static PyObject *__pyx_n_s_BaseExpression_sameQ;
  static PyObject *__pyx_n_s_BaseExpression_sequences;
  static PyObject *__pyx_n_s_BaseExpression_to_mpmath;
  static PyObject *__pyx_n_s_BaseExpression_to_sympy;
  static PyObject *__pyx_n_s_BaseExpression_user_hash;
  static PyObject *__pyx_kp_u_Box;
  static PyObject *__pyx_n_s_BoxConstruct;
  static PyObject *__pyx_n_s_BoxError;
  static PyObject *__pyx_n_s_BoxError___init;
  static PyObject *__pyx_n_u_ByteArray;
  static PyObject *__pyx_n_s_ByteArrayAtom;
  static PyObject *__pyx_n_u_ByteArrayAtom;
  static PyObject *__pyx_n_s_ByteArrayAtom___getnewargs;
  static PyObject *__pyx_n_s_ByteArrayAtom___hash;
  static PyObject *__pyx_n_s_ByteArrayAtom___new;
  static PyObject *__pyx_n_s_ByteArrayAtom___str;
  static PyObject *__pyx_n_s_ByteArrayAtom_atom_to_boxes;
  static PyObject *__pyx_n_s_ByteArrayAtom_boxes_to_mathml;
  static PyObject *__pyx_n_s_ByteArrayAtom_boxes_to_tex;
  static PyObject *__pyx_n_s_ByteArrayAtom_boxes_to_text;
  static PyObject *__pyx_n_s_ByteArrayAtom_default_format;
  static PyObject *__pyx_n_s_ByteArrayAtom_do_copy;
  static PyObject *__pyx_n_s_ByteArrayAtom_get_sort_key;
  static PyObject *__pyx_n_s_ByteArrayAtom_get_string_value;
  static PyObject *__pyx_n_s_ByteArrayAtom_sameQ;
  static PyObject *__pyx_n_s_ByteArrayAtom_to_python;
  static PyObject *__pyx_n_s_ByteArrayAtom_to_sympy;
  static PyObject *__pyx_n_s_ByteArrayAtom_user_hash;
  static PyObject *__pyx_n_s_COMPARE_PREC;
  static PyObject *__pyx_n_u_Catalan;
  static PyObject *__pyx_n_s_Complex;
  static PyObject *__pyx_n_u_Complex;
  static PyObject *__pyx_n_u_ComplexInfinity;
  static PyObject *__pyx_kp_u_Complex_2;
  static PyObject *__pyx_n_s_Complex___eq;
  static PyObject *__pyx_n_s_Complex___getnewargs;
  static PyObject *__pyx_n_s_Complex___hash;
  static PyObject *__pyx_n_s_Complex___neg;
  static PyObject *__pyx_n_s_Complex___new;
  static PyObject *__pyx_n_s_Complex___str;
  static PyObject *__pyx_n_s_Complex_atom_to_boxes;
  static PyObject *__pyx_n_s_Complex_default_format;
  static PyObject *__pyx_n_s_Complex_do_copy;
  static PyObject *__pyx_n_s_Complex_do_format;
  static PyObject *__pyx_n_s_Complex_evaluate;
  static PyObject *__pyx_n_s_Complex_get_float_value;
  static PyObject *__pyx_n_s_Complex_get_precision;
  static PyObject *__pyx_n_s_Complex_get_sort_key;
  static PyObject *__pyx_n_s_Complex_is_approx_zero;
  static PyObject *__pyx_n_s_Complex_is_machine_precision;
  static PyObject *__pyx_n_s_Complex_is_zero;
  static PyObject *__pyx_n_s_Complex_round;
  static PyObject *__pyx_n_s_Complex_sameQ;
  static PyObject *__pyx_n_s_Complex_to_mpmath;
  static PyObject *__pyx_n_s_Complex_to_python;
  static PyObject *__pyx_n_s_Complex_to_sympy;
  static PyObject *__pyx_n_s_Complex_user_hash;
  static PyObject *__pyx_kp_s_Complex_wraps_two_real_valued_N;
  static PyObject *__pyx_n_u_Default;
  static PyObject *__pyx_n_u_DigitBlock;
  static PyObject *__pyx_n_u_DirectedInfinity;
  static PyObject *__pyx_n_u_Divide;
  static PyObject *__pyx_n_u_E;
  static PyObject *__pyx_n_u_EulerGamma;
  static PyObject *__pyx_n_u_Evaluate;
  static PyObject *__pyx_n_s_ExponentFunction;
  static PyObject *__pyx_n_u_ExponentFunction_2;
  static PyObject *__pyx_n_u_ExponentStep;
  static PyObject *__pyx_n_s_Expression;
  static PyObject *__pyx_n_u_Expression;
  static PyObject *__pyx_n_s_ExpressionCache;
  static PyObject *__pyx_n_s_ExpressionCache___init;
  static PyObject *__pyx_n_s_ExpressionCache_copy;
  static PyObject *__pyx_n_s_ExpressionCache_reordered;
  static PyObject *__pyx_n_s_ExpressionCache_sliced;
  static PyObject *__pyx_n_s_ExpressionCache_sliced_locals_ge;
  static PyObject *__pyx_n_s_ExpressionCache_union;
  static PyObject *__pyx_n_s_ExpressionPointer;
  static PyObject *__pyx_n_s_ExpressionPointer___init;
  static PyObject *__pyx_n_s_ExpressionPointer___str;
  static PyObject *__pyx_n_s_ExpressionPointer_replace;
  static PyObject *__pyx_n_s_Expression___getnewargs;
  static PyObject *__pyx_n_s_Expression___hash;
  static PyObject *__pyx_n_s_Expression___new;
  static PyObject *__pyx_n_s_Expression___new___locals_genexp;
  static PyObject *__pyx_n_s_Expression___repr;
  static PyObject *__pyx_n_s_Expression___str;
  static PyObject *__pyx_n_s_Expression__as_sympy_function;
  static PyObject *__pyx_n_s_Expression__flatten_sequence;
  static PyObject *__pyx_n_s_Expression__no_symbol;
  static PyObject *__pyx_n_s_Expression__rebuild_cache;
  static PyObject *__pyx_n_s_Expression__timestamp_cache;
  static PyObject *__pyx_n_s_Expression_apply_rules;
  static PyObject *__pyx_n_s_Expression_apply_rules_locals_ap;
  static PyObject *__pyx_n_s_Expression_apply_rules_locals_de;
  static PyObject *__pyx_n_s_Expression_boxes_to_mathml;
  static PyObject *__pyx_n_s_Expression_boxes_to_mathml_local;
  static PyObject *__pyx_n_s_Expression_boxes_to_mathml_local_2;
  static PyObject *__pyx_n_s_Expression_boxes_to_tex;
  static PyObject *__pyx_n_s_Expression_boxes_to_tex_locals_b;
  static PyObject *__pyx_n_s_Expression_boxes_to_text;
  static PyObject *__pyx_n_s_Expression_copy;
  static PyObject *__pyx_n_s_Expression_copy_locals_genexpr;
  static PyObject *__pyx_n_s_Expression_default_format;
  static PyObject *__pyx_n_s_Expression_do_format;
  static PyObject *__pyx_n_s_Expression_equal2;
  static PyObject *__pyx_n_s_Expression_evaluate;
  static PyObject *__pyx_n_s_Expression_evaluate_leaves;
  static PyObject *__pyx_n_s_Expression_evaluate_next;
  static PyObject *__pyx_n_s_Expression_evaluate_next_locals;
  static PyObject *__pyx_n_s_Expression_evaluate_next_locals_2;
  static PyObject *__pyx_n_s_Expression_evaluate_next_locals_3;
  static PyObject *__pyx_n_s_Expression_evaluate_next_locals_4;
  static PyObject *__pyx_n_s_Expression_filter;
  static PyObject *__pyx_n_s_Expression_filter_leaves;
  static PyObject *__pyx_n_s_Expression_flatten;
  static PyObject *__pyx_n_s_Expression_flatten_pattern_seque;
  static PyObject *__pyx_n_s_Expression_flatten_pattern_seque_2;
  static PyObject *__pyx_n_s_Expression_flatten_sequence;
  static PyObject *__pyx_n_s_Expression_flatten_sequence_loca;
  static PyObject *__pyx_n_s_Expression_get_atoms;
  static PyObject *__pyx_n_s_Expression_get_attributes;
  static PyObject *__pyx_n_s_Expression_get_attributes_locals;
  static PyObject *__pyx_n_s_Expression_get_head;
  static PyObject *__pyx_n_s_Expression_get_leaves;
  static PyObject *__pyx_n_s_Expression_get_lookup_name;
  static PyObject *__pyx_n_s_Expression_get_mutable_leaves;
  static PyObject *__pyx_n_s_Expression_get_sort_key;
  static PyObject *__pyx_n_s_Expression_get_sort_key_locals_g;
  static PyObject *__pyx_n_s_Expression_has_changed;
  static PyObject *__pyx_n_s_Expression_has_form;
  static PyObject *__pyx_n_s_Expression_has_symbol;
  static PyObject *__pyx_n_s_Expression_has_symbol_locals_gen;
  static PyObject *__pyx_n_s_Expression_head;
  static PyObject *__pyx_kp_u_Expression_head_is_write_protect;
  static PyObject *__pyx_n_s_Expression_is_numeric;
  static PyObject *__pyx_n_s_Expression_is_numeric_locals_gen;
  static PyObject *__pyx_n_s_Expression_leaves;
  static PyObject *__pyx_kp_u_Expression_leaves_is_write_prote;
  static PyObject *__pyx_n_s_Expression_numerify;
  static PyObject *__pyx_n_s_Expression_process_style_box;
  static PyObject *__pyx_n_s_Expression_replace_slots;
  static PyObject *__pyx_n_s_Expression_replace_vars;
  static PyObject *__pyx_n_s_Expression_replace_vars_locals_g;
  static PyObject *__pyx_n_s_Expression_restructure;
  static PyObject *__pyx_kp_u_Expression_s;
  static PyObject *__pyx_n_s_Expression_sameQ;
  static PyObject *__pyx_n_s_Expression_sequences;
  static PyObject *__pyx_n_s_Expression_set_head;
  static PyObject *__pyx_n_s_Expression_set_leaf;
  static PyObject *__pyx_n_s_Expression_set_positions;
  static PyObject *__pyx_n_s_Expression_set_reordered_leaves;
  static PyObject *__pyx_n_s_Expression_shallow_copy;
  static PyObject *__pyx_n_s_Expression_slice;
  static PyObject *__pyx_n_s_Expression_sort;
  static PyObject *__pyx_n_s_Expression_sort_locals_lambda;
  static PyObject *__pyx_n_s_Expression_thread;
  static PyObject *__pyx_n_s_Expression_to_python;
  static PyObject *__pyx_n_s_Expression_to_sympy;
  static PyObject *__pyx_n_s_Expression_user_hash;
  static PyObject *__pyx_kp_u_Failed;
  static PyObject *__pyx_n_u_False;
  static PyObject *__pyx_n_s_Float;
  static PyObject *__pyx_n_u_Floor;
  static PyObject *__pyx_n_u_Form;
  static PyObject *__pyx_n_u_FractionBox;
  static PyObject *__pyx_n_u_FullForm;
  static PyObject *__pyx_n_s_Function;
  static PyObject *__pyx_n_u_Function;
  static PyObject *__pyx_kp_u_Global;
  static PyObject *__pyx_n_u_GoldenRatio;
  static PyObject *__pyx_n_u_HoldForm;
  static PyObject *__pyx_n_s_I;
  static PyObject *__pyx_n_u_I;
  static PyObject *__pyx_n_u_Infinity;
  static PyObject *__pyx_n_u_InputForm;
  static PyObject *__pyx_n_s_Integer;
  static PyObject *__pyx_n_u_Integer;
  static PyObject *__pyx_n_s_Integer0;
  static PyObject *__pyx_n_s_Integer1;
  static PyObject *__pyx_n_s_Integer___getnewargs;
  static PyObject *__pyx_n_s_Integer___hash;
  static PyObject *__pyx_n_s_Integer___init;
  static PyObject *__pyx_n_s_Integer___neg;
  static PyObject *__pyx_n_s_Integer___new;
  static PyObject *__pyx_n_s_Integer_atom_to_boxes;
  static PyObject *__pyx_n_s_Integer_boxes_to_mathml;
  static PyObject *__pyx_n_s_Integer_boxes_to_tex;
  static PyObject *__pyx_n_s_Integer_boxes_to_text;
  static PyObject *__pyx_n_s_Integer_default_format;
  static PyObject *__pyx_n_s_Integer_do_copy;
  static PyObject *__pyx_n_s_Integer_evaluate;
  static PyObject *__pyx_n_s_Integer_get_int_value;
  static PyObject *__pyx_n_s_Integer_get_sort_key;
  static PyObject *__pyx_n_s_Integer_is_zero;
  static PyObject *__pyx_n_s_Integer_make_boxes;
  static PyObject *__pyx_n_s_Integer_round;
  static PyObject *__pyx_n_s_Integer_sameQ;
  static PyObject *__pyx_n_s_Integer_to_mpmath;
  static PyObject *__pyx_n_s_Integer_to_python;
  static PyObject *__pyx_n_s_Integer_to_sympy;
  static PyObject *__pyx_n_s_Integer_user_hash;
  static PyObject *__pyx_kp_u_IterationLimit;
  static PyObject *__pyx_n_s_KeyComparable;
  static PyObject *__pyx_n_s_KeyComparable___eq;
  static PyObject *__pyx_n_s_KeyComparable___ge;
  static PyObject *__pyx_n_s_KeyComparable___gt;
  static PyObject *__pyx_n_s_KeyComparable___le;
  static PyObject *__pyx_n_s_KeyComparable___lt;
  static PyObject *__pyx_n_s_KeyComparable___ne;
  static PyObject *__pyx_n_s_KeyComparable_get_sort_key;
  static PyObject *__pyx_n_s_LinkedStructure;
  static PyObject *__pyx_n_s_LinkedStructure___call;
  static PyObject *__pyx_n_s_LinkedStructure___init;
  static PyObject *__pyx_n_s_LinkedStructure_filter;
  static PyObject *__pyx_n_s_LinkedStructure_slice;
  static PyObject *__pyx_n_s_List;
  static PyObject *__pyx_n_u_List;
  static PyObject *__pyx_n_u_MachinePrecision;
  static PyObject *__pyx_n_s_MachineReal;
  static PyObject *__pyx_n_u_MachineReal;
  static PyObject *__pyx_n_s_MachineReal___getnewargs;
  static PyObject *__pyx_n_s_MachineReal___neg;
  static PyObject *__pyx_n_s_MachineReal___new;
  static PyObject *__pyx_n_s_MachineReal_do_copy;
  static PyObject *__pyx_n_s_MachineReal_get_float_value;
  static PyObject *__pyx_n_s_MachineReal_get_precision;
  static PyObject *__pyx_n_s_MachineReal_is_approx_zero;
  static PyObject *__pyx_n_s_MachineReal_is_machine_precision;
  static PyObject *__pyx_n_s_MachineReal_is_zero;
  static PyObject *__pyx_n_s_MachineReal_make_boxes;
  static PyObject *__pyx_n_s_MachineReal_round;
  static PyObject *__pyx_n_s_MachineReal_sameQ;
  static PyObject *__pyx_n_s_MachineReal_to_mpmath;
  static PyObject *__pyx_n_s_MachineReal_to_python;
  static PyObject *__pyx_n_s_MachineReal_to_sympy;
  static PyObject *__pyx_kp_s_Machine_precision_real_number_S;
  static PyObject *__pyx_n_u_MakeBoxes;
  static PyObject *__pyx_n_u_MathMLForm;
  static PyObject *__pyx_n_u_Minus;
  static PyObject *__pyx_n_s_Monomial;
  static PyObject *__pyx_n_s_Monomial___cmp;
  static PyObject *__pyx_n_s_Monomial___cmp_locals_genexpr;
  static PyObject *__pyx_n_s_Monomial___eq;
  static PyObject *__pyx_n_s_Monomial___ge;
  static PyObject *__pyx_n_s_Monomial___gt;
  static PyObject *__pyx_n_s_Monomial___init;
  static PyObject *__pyx_n_s_Monomial___le;
  static PyObject *__pyx_n_s_Monomial___lt;
  static PyObject *__pyx_n_s_Monomial___ne;
  static PyObject *__pyx_n_s_Monomial__cmp;
  static PyObject *__pyx_n_u_N;
  static PyObject *__pyx_n_s_NotImplementedError;
  static PyObject *__pyx_n_u_Null;
  static PyObject *__pyx_n_s_Number;
  static PyObject *__pyx_n_s_NumberFormat;
  static PyObject *__pyx_n_u_NumberFormat_2;
  static PyObject *__pyx_n_u_NumberMultiplier;
  static PyObject *__pyx_n_u_NumberPadding;
  static PyObject *__pyx_n_u_NumberPoint;
  static PyObject *__pyx_n_u_NumberSigns;
  static PyObject *__pyx_n_s_NumberSymbol;
  static PyObject *__pyx_n_s_Number___str;
  static PyObject *__pyx_n_s_Number_is_numeric;
  static PyObject *__pyx_n_s_Optional;
  static PyObject *__pyx_n_u_OutputForm;
  static PyObject *__pyx_n_s_OverflowError;
  static PyObject *__pyx_n_u_Pi;
  static PyObject *__pyx_n_u_Plus;
  static PyObject *__pyx_n_u_Power;
  static PyObject *__pyx_n_s_PrecisionReal;
  static PyObject *__pyx_n_u_PrecisionReal;
  static PyObject *__pyx_n_s_PrecisionReal___getnewargs;
  static PyObject *__pyx_n_s_PrecisionReal___neg;
  static PyObject *__pyx_n_s_PrecisionReal___new;
  static PyObject *__pyx_n_s_PrecisionReal_do_copy;
  static PyObject *__pyx_n_s_PrecisionReal_get_precision;
  static PyObject *__pyx_n_s_PrecisionReal_is_zero;
  static PyObject *__pyx_n_s_PrecisionReal_make_boxes;
  static PyObject *__pyx_n_s_PrecisionReal_round;
  static PyObject *__pyx_n_s_PrecisionReal_sameQ;
  static PyObject *__pyx_n_s_PrecisionReal_to_mpmath;
  static PyObject *__pyx_n_s_PrecisionReal_to_python;
  static PyObject *__pyx_n_s_PrecisionReal_to_sympy;
  static PyObject *__pyx_n_s_Rational;
  static PyObject *__pyx_n_u_Rational;
  static PyObject *__pyx_n_s_RationalOneHalf;
  static PyObject *__pyx_n_s_Rational___getnewargs;
  static PyObject *__pyx_n_s_Rational___hash;
  static PyObject *__pyx_n_s_Rational___neg;
  static PyObject *__pyx_n_s_Rational___new;
  static PyObject *__pyx_n_s_Rational_atom_to_boxes;
  static PyObject *__pyx_n_s_Rational_default_format;
  static PyObject *__pyx_n_s_Rational_denominator;
  static PyObject *__pyx_n_s_Rational_do_copy;
  static PyObject *__pyx_n_s_Rational_do_format;
  static PyObject *__pyx_n_s_Rational_evaluate;
  static PyObject *__pyx_n_s_Rational_get_sort_key;
  static PyObject *__pyx_n_s_Rational_is_zero;
  static PyObject *__pyx_n_s_Rational_numerator;
  static PyObject *__pyx_n_s_Rational_round;
  static PyObject *__pyx_kp_u_Rational_s_s;
  static PyObject *__pyx_n_s_Rational_sameQ;
  static PyObject *__pyx_n_s_Rational_to_mpmath;
  static PyObject *__pyx_n_s_Rational_to_python;
  static PyObject *__pyx_n_s_Rational_to_sympy;
  static PyObject *__pyx_n_s_Rational_user_hash;
  static PyObject *__pyx_n_s_Real;
  static PyObject *__pyx_n_u_Real;
  static PyObject *__pyx_n_s_Real___eq;
  static PyObject *__pyx_n_s_Real___hash;
  static PyObject *__pyx_n_s_Real___ne;
  static PyObject *__pyx_n_s_Real___new;
  static PyObject *__pyx_n_s_Real_atom_to_boxes;
  static PyObject *__pyx_n_s_Real_boxes_to_mathml;
  static PyObject *__pyx_n_s_Real_boxes_to_tex;
  static PyObject *__pyx_n_s_Real_boxes_to_text;
  static PyObject *__pyx_n_s_Real_evaluate;
  static PyObject *__pyx_n_s_Real_get_atom_name;
  static PyObject *__pyx_n_s_Real_get_sort_key;
  static PyObject *__pyx_n_s_Real_user_hash;
  static PyObject *__pyx_n_s_ReturnInterrupt;
  static PyObject *__pyx_n_u_RowBox;
  static PyObject *__pyx_n_s_Rule;
  static PyObject *__pyx_n_u_Rule;
  static PyObject *__pyx_n_u_RuleDelayed;
  static PyObject *__pyx_n_u_Sequence;
  static PyObject *__pyx_n_u_SignPadding;
  static PyObject *__pyx_n_u_Sin;
  static PyObject *__pyx_n_u_Slot;
  static PyObject *__pyx_n_u_SlotSequence;
  static PyObject *__pyx_n_u_Sqrt;
  static PyObject *__pyx_n_u_StandardForm;
  static PyObject *__pyx_n_s_String;
  static PyObject *__pyx_n_u_String;
  static PyObject *__pyx_n_s_StringFromPython;
  static PyObject *__pyx_n_s_StringFromPython___new;
  static PyObject *__pyx_n_s_String___getnewargs;
  static PyObject *__pyx_n_s_String___hash;
  static PyObject *__pyx_n_s_String___new;
  static PyObject *__pyx_n_s_String___str;
  static PyObject *__pyx_n_s_String_atom_to_boxes;
  static PyObject *__pyx_n_s_String_boxes_to_mathml;
  static PyObject *__pyx_n_s_String_boxes_to_mathml_locals_re;
  static PyObject *__pyx_n_s_String_boxes_to_tex;
  static PyObject *__pyx_n_s_String_boxes_to_tex_locals_rende;
  static PyObject *__pyx_n_s_String_boxes_to_text;
  static PyObject *__pyx_n_s_String_default_format;
  static PyObject *__pyx_n_s_String_do_copy;
  static PyObject *__pyx_n_s_String_get_sort_key;
  static PyObject *__pyx_n_s_String_get_string_value;
  static PyObject *__pyx_n_s_String_sameQ;
  static PyObject *__pyx_n_s_String_to_python;
  static PyObject *__pyx_n_s_String_to_sympy;
  static PyObject *__pyx_n_s_String_user_hash;
  static PyObject *__pyx_n_s_Structure;
  static PyObject *__pyx_n_s_Structure___call;
  static PyObject *__pyx_n_s_Structure_filter;
  static PyObject *__pyx_n_s_Structure_slice;
  static PyObject *__pyx_kp_u_Structure_slice_only_supports_sl;
  static PyObject *__pyx_n_u_StyleBox;
  static PyObject *__pyx_n_u_Subtract;
  static PyObject *__pyx_n_u_SuperscriptBox;
  static PyObject *__pyx_n_s_Symbol;
  static PyObject *__pyx_n_u_Symbol;
  static PyObject *__pyx_n_s_SymbolAborted;
  static PyObject *__pyx_n_s_SymbolAssociation;
  static PyObject *__pyx_n_s_SymbolByteArray;
  static PyObject *__pyx_n_s_SymbolComplexInfinity;
  static PyObject *__pyx_n_s_SymbolDirectedInfinity;
  static PyObject *__pyx_n_s_SymbolFailed;
  static PyObject *__pyx_n_s_SymbolFalse;
  static PyObject *__pyx_n_s_SymbolInfinity;
  static PyObject *__pyx_n_s_SymbolList;
  static PyObject *__pyx_n_s_SymbolMakeBoxes;
  static PyObject *__pyx_n_s_SymbolN;
  static PyObject *__pyx_n_s_SymbolNull;
  static PyObject *__pyx_n_s_SymbolRule;
  static PyObject *__pyx_n_s_SymbolSequence;
  static PyObject *__pyx_n_s_SymbolTrue;
  static PyObject *__pyx_n_s_SymbolUndefined;
  static PyObject *__pyx_n_s_Symbol___getnewargs;
  static PyObject *__pyx_n_s_Symbol___hash;
  static PyObject *__pyx_n_s_Symbol___new;
  static PyObject *__pyx_n_s_Symbol___str;
  static PyObject *__pyx_n_s_Symbol_atom_to_boxes;
  static PyObject *__pyx_n_s_Symbol_boxes_to_text;
  static PyObject *__pyx_n_s_Symbol_default_format;
  static PyObject *__pyx_n_s_Symbol_do_copy;
  static PyObject *__pyx_n_s_Symbol_equal2;
  static PyObject *__pyx_n_s_Symbol_evaluate;
  static PyObject *__pyx_n_s_Symbol_get_attributes;
  static PyObject *__pyx_n_s_Symbol_get_name;
  static PyObject *__pyx_n_s_Symbol_get_sort_key;
  static PyObject *__pyx_n_s_Symbol_has_symbol;
  static PyObject *__pyx_n_s_Symbol_is_numeric;
  static PyObject *__pyx_n_s_Symbol_is_symbol;
  static PyObject *__pyx_n_s_Symbol_is_true;
  static PyObject *__pyx_n_s_Symbol_replace_vars;
  static PyObject *__pyx_n_s_Symbol_replace_vars_locals_genex;
  static PyObject *__pyx_n_s_Symbol_sameQ;
  static PyObject *__pyx_n_s_Symbol_to_python;
  static PyObject *__pyx_n_s_Symbol_to_sympy;
  static PyObject *__pyx_n_s_Symbol_user_hash;
  static PyObject *__pyx_n_s_SympyExpression;
  static PyObject *__pyx_kp_u_System;
  static PyObject *__pyx_kp_u_System_Alternatives;
  static PyObject *__pyx_kp_u_System_Blank;
  static PyObject *__pyx_kp_u_System_BlankNullSequence;
  static PyObject *__pyx_kp_u_System_BlankSequence;
  static PyObject *__pyx_kp_u_System_Block;
  static PyObject *__pyx_kp_u_System_Compile;
  static PyObject *__pyx_kp_u_System_CompiledFunction;
  static PyObject *__pyx_kp_b_System_Complex;
  static PyObject *__pyx_kp_u_System_Condition;
  static PyObject *__pyx_kp_u_System_DefaultValues;
  static PyObject *__pyx_kp_u_System_DirectedInfinity;
  static PyObject *__pyx_kp_u_System_Evaluate;
  static PyObject *__pyx_kp_u_System_Flat;
  static PyObject *__pyx_kp_u_System_FractionBox;
  static PyObject *__pyx_kp_u_System_FullForm;
  static PyObject *__pyx_kp_u_System_Function;
  static PyObject *__pyx_kp_u_System_GraphBox;
  static PyObject *__pyx_kp_u_System_Graphics;
  static PyObject *__pyx_kp_u_System_Graphics3D;
  static PyObject *__pyx_kp_u_System_HoldAll;
  static PyObject *__pyx_kp_u_System_HoldAllComplete;
  static PyObject *__pyx_kp_u_System_HoldFirst;
  static PyObject *__pyx_kp_u_System_HoldForm;
  static PyObject *__pyx_kp_u_System_HoldRest;
  static PyObject *__pyx_kp_u_System_ImageSizeMultipliers;
  static PyObject *__pyx_kp_u_System_InputForm;
  static PyObject *__pyx_kp_b_System_Integer;
  static PyObject *__pyx_kp_u_System_List;
  static PyObject *__pyx_kp_u_System_Listable;
  static PyObject *__pyx_kp_u_System_MathMLForm;
  static PyObject *__pyx_kp_u_System_Module;
  static PyObject *__pyx_kp_u_System_NumberForm;
  static PyObject *__pyx_kp_u_System_Optional;
  static PyObject *__pyx_kp_u_System_OptionsPattern;
  static PyObject *__pyx_kp_u_System_Orderless;
  static PyObject *__pyx_kp_u_System_OutputForm;
  static PyObject *__pyx_kp_u_System_Pattern;
  static PyObject *__pyx_kp_u_System_PatternTest;
  static PyObject *__pyx_kp_u_System_Postfix;
  static PyObject *__pyx_kp_b_System_Rational;
  static PyObject *__pyx_kp_b_System_Real;
  static PyObject *__pyx_kp_u_System_Repeated;
  static PyObject *__pyx_kp_u_System_RepeatedNull;
  static PyObject *__pyx_kp_u_System_RowBox;
  static PyObject *__pyx_kp_u_System_Sequence;
  static PyObject *__pyx_kp_u_System_SequenceHold;
  static PyObject *__pyx_kp_u_System_ShowStringCharacters;
  static PyObject *__pyx_kp_u_System_Slot;
  static PyObject *__pyx_kp_u_System_SlotSequence;
  static PyObject *__pyx_kp_u_System_SqrtBox;
  static PyObject *__pyx_kp_u_System_StandardForm;
  static PyObject *__pyx_kp_u_System_SubscriptBox;
  static PyObject *__pyx_kp_u_System_SubsuperscriptBox;
  static PyObject *__pyx_kp_u_System_SuperscriptBox;
  static PyObject *__pyx_kp_b_System_Symbol;
  static PyObject *__pyx_kp_u_System_TeXForm;
  static PyObject *__pyx_kp_u_System_Times;
  static PyObject *__pyx_kp_u_System_Verbatim;
  static PyObject *__pyx_kp_u_System_With;
  static PyObject *__pyx_n_s_TEX_REPLACE;
  static PyObject *__pyx_n_s_TEX_REPLACE_RE;
  static PyObject *__pyx_n_s_TEX_TEXT_REPLACE;
  static PyObject *__pyx_n_u_TeXForm;
  static PyObject *__pyx_n_u_Thread;
  static PyObject *__pyx_n_u_Times;
  static PyObject *__pyx_n_u_TraditionalForm;
  static PyObject *__pyx_n_u_True;
  static PyObject *__pyx_n_s_Tuple;
  static PyObject *__pyx_n_s_TypeError;
  static PyObject *__pyx_n_u_Undefined;
  static PyObject *__pyx_n_u_Unevaluated;
  static PyObject *__pyx_n_s_Union;
  static PyObject *__pyx_kp_u_Unknown_number_type;
  static PyObject *__pyx_n_s_UnlinkedStructure;
  static PyObject *__pyx_n_s_UnlinkedStructure___call;
  static PyObject *__pyx_n_s_UnlinkedStructure___init;
  static PyObject *__pyx_n_s_UnlinkedStructure_filter;
  static PyObject *__pyx_n_s_UnlinkedStructure_slice;
  static PyObject *__pyx_n_s_ValueError;
  static PyObject *__pyx_kp_u__100;
  static PyObject *__pyx_kp_u__101;
  static PyObject *__pyx_kp_u__102;
  static PyObject *__pyx_kp_u__103;
  static PyObject *__pyx_kp_u__105;
  static PyObject *__pyx_kp_u__106;
  static PyObject *__pyx_kp_u__108;
  static PyObject *__pyx_kp_u__111;
  static PyObject *__pyx_kp_u__2;
  static PyObject *__pyx_kp_u__3;
  static PyObject *__pyx_kp_u__33;
  static PyObject *__pyx_kp_u__34;
  static PyObject *__pyx_kp_u__35;
  static PyObject *__pyx_kp_u__4;
  static PyObject *__pyx_kp_u__42;
  static PyObject *__pyx_kp_u__44;
  static PyObject *__pyx_kp_u__45;
  static PyObject *__pyx_kp_u__46;
  static PyObject *__pyx_kp_u__48;
  static PyObject *__pyx_kp_u__5;
  static PyObject *__pyx_kp_u__51;
  static PyObject *__pyx_kp_u__52;
  static PyObject *__pyx_kp_u__53;
  static PyObject *__pyx_kp_u__532;
  static PyObject *__pyx_n_u__54;
  static PyObject *__pyx_kp_u__58;
  static PyObject *__pyx_kp_u__59;
  static PyObject *__pyx_kp_u__60;
  static PyObject *__pyx_kp_u__65;
  static PyObject *__pyx_kp_u__69;
  static PyObject *__pyx_kp_u__7;
  static PyObject *__pyx_kp_u__70;
  static PyObject *__pyx_kp_u__71;
  static PyObject *__pyx_kp_u__73;
  static PyObject *__pyx_kp_u__75;
  static PyObject *__pyx_kp_u__758;
  static PyObject *__pyx_kp_u__759;
  static PyObject *__pyx_kp_u__760;
  static PyObject *__pyx_kp_u__761;
  static PyObject *__pyx_kp_u__762;
  static PyObject *__pyx_kp_u__763;
  static PyObject *__pyx_kp_u__764;
  static PyObject *__pyx_kp_u__765;
  static PyObject *__pyx_kp_u__766;
  static PyObject *__pyx_kp_u__767;
  static PyObject *__pyx_kp_u__768;
  static PyObject *__pyx_kp_u__769;
  static PyObject *__pyx_kp_u__770;
  static PyObject *__pyx_kp_u__771;
  static PyObject *__pyx_kp_u__772;
  static PyObject *__pyx_kp_u__8;
  static PyObject *__pyx_kp_u__80;
  static PyObject *__pyx_kp_u__81;
  static PyObject *__pyx_kp_u__82;
  static PyObject *__pyx_kp_u__88;
  static PyObject *__pyx_n_u__89;
  static PyObject *__pyx_kp_u__90;
  static PyObject *__pyx_kp_u__94;
  static PyObject *__pyx_kp_u__95;
  static PyObject *__pyx_kp_u__96;
  static PyObject *__pyx_kp_u__97;
  static PyObject *__pyx_kp_u__98;
  static PyObject *__pyx_kp_u__99;
  static PyObject *__pyx_n_s_a;
  static PyObject *__pyx_n_s_abs;
  static PyObject *__pyx_n_s_abs_eps;
  static PyObject *__pyx_n_s_add;
  static PyObject *__pyx_n_s_allow_initial_backquote;
  static PyObject *__pyx_n_s_allow_symbols;
  static PyObject *__pyx_n_s_almosteq;
  static PyObject *__pyx_kp_u_amp;
  static PyObject *__pyx_n_s_append;
  static PyObject *__pyx_n_s_applied;
  static PyObject *__pyx_n_s_apply;
  static PyObject *__pyx_n_s_apply_leaf;
  static PyObject *__pyx_n_s_apply_rules;
  static PyObject *__pyx_n_s_arg;
  static PyObject *__pyx_n_s_args;
  static PyObject *__pyx_n_s_as_numer_denom;
  static PyObject *__pyx_n_s_as_sympy_function;
  static PyObject *__pyx_n_s_atom;
  static PyObject *__pyx_n_s_atom_list_constructor;
  static PyObject *__pyx_n_s_atom_list_constructor_locals_con;
  static PyObject *__pyx_n_s_atom_list_constructor_locals_gen;
  static PyObject *__pyx_n_s_atom_names;
  static PyObject *__pyx_n_s_atom_to_boxes;
  static PyObject *__pyx_n_s_atoms;
  static PyObject *__pyx_n_s_attributes;
  static PyObject *__pyx_n_s_b;
  static PyObject *__pyx_n_s_b64decode;
  static PyObject *__pyx_n_s_b64encode;
  static PyObject *__pyx_kp_u_backslash;
  static PyObject *__pyx_kp_u_backslash_2;
  static PyObject *__pyx_n_s_base;
  static PyObject *__pyx_n_s_base64;
  static PyObject *__pyx_n_s_bisect;
  static PyObject *__pyx_n_s_bisect_left;
  static PyObject *__pyx_n_s_block;
  static PyObject *__pyx_n_s_body;
  static PyObject *__pyx_n_s_box;
  static PyObject *__pyx_n_s_boxes_to_mathml;
  static PyObject *__pyx_n_s_boxes_to_tex;
  static PyObject *__pyx_n_s_boxes_to_text;
  static PyObject *__pyx_n_s_builtin;
  static PyObject *__pyx_n_s_builtins;
  static PyObject *__pyx_n_s_builtins_by_module;
  static PyObject *__pyx_n_s_c;
  static PyObject *__pyx_n_u_c;
  static PyObject *__pyx_n_s_cache;
  static PyObject *__pyx_n_s_cache_2;
  static PyObject *__pyx_n_s_call;
  static PyObject *__pyx_n_s_callback;
  static PyObject *__pyx_kp_u_cannot_be_formatted_as;
  static PyObject *__pyx_n_s_cfunc;
  static PyObject *__pyx_n_s_chain;
  static PyObject *__pyx_n_s_check_stopped;
  static PyObject *__pyx_n_s_class;
  static PyObject *__pyx_n_s_clear_cache;
  static PyObject *__pyx_n_s_cline_in_traceback;
  static PyObject *__pyx_n_s_close;
  static PyObject *__pyx_n_s_cls;
  static PyObject *__pyx_n_s_cmp;
  static PyObject *__pyx_n_s_compile;
  static PyObject *__pyx_n_s_compiled;
  static PyObject *__pyx_n_s_cond;
  static PyObject *__pyx_n_s_construct;
  static PyObject *__pyx_n_s_content;
  static PyObject *__pyx_n_s_context;
  static PyObject *__pyx_n_u_convert_all_global_functions;
  static PyObject *__pyx_n_u_converted_functions;
  static PyObject *__pyx_n_s_copy;
  static PyObject *__pyx_n_s_count;
  static PyObject *__pyx_n_s_ctx;
  static PyObject *__pyx_n_s_d;
  static PyObject *__pyx_n_u_d;
  static PyObject *__pyx_kp_u_d_2;
  static PyObject *__pyx_n_s_dec;
  static PyObject *__pyx_n_s_dec_recursion_depth;
  static PyObject *__pyx_n_s_decode;
  static PyObject *__pyx_n_s_default_format;
  static PyObject *__pyx_n_s_defaultexpr;
  static PyObject *__pyx_n_s_defined_symbols;
  static PyObject *__pyx_n_s_definition;
  static PyObject *__pyx_n_s_definitions;
  static PyObject *__pyx_n_s_denominator;
  static PyObject *__pyx_n_s_deps;
  static PyObject *__pyx_n_s_descend;
  static PyObject *__pyx_n_s_digits;
  static PyObject *__pyx_n_s_dim;
  static PyObject *__pyx_n_s_direction;
  static PyObject *__pyx_n_s_dirty_leaves;
  static PyObject *__pyx_n_s_do_copy;
  static PyObject *__pyx_n_s_do_flatten;
  static PyObject *__pyx_n_s_do_format;
  static PyObject *__pyx_n_s_doc;
  static PyObject *__pyx_n_s_done;
  static PyObject *__pyx_n_u_down;
  static PyObject *__pyx_n_s_dps;
  static PyObject *__pyx_n_s_encode;
  static PyObject *__pyx_n_s_encode_mathml;
  static PyObject *__pyx_n_s_encode_tex;
  static PyObject *__pyx_n_s_encode_tex_locals_replace;
  static PyObject *__pyx_n_s_encoded_text;
  static PyObject *__pyx_n_s_endswith;
  static PyObject *__pyx_n_s_ensure_context;
  static PyObject *__pyx_n_s_enter;
  static PyObject *__pyx_n_s_entries;
  static PyObject *__pyx_n_s_enumerate;
  static PyObject *__pyx_n_s_eq;
  static PyObject *__pyx_n_s_equal2;
  static PyObject *__pyx_n_s_equal_heads;
  static PyObject *__pyx_n_s_error;
  static PyObject *__pyx_n_s_escape;
  static PyObject *__pyx_n_s_eval_range;
  static PyObject *__pyx_n_s_evaluate;
  static PyObject *__pyx_n_s_evaluate_leaves;
  static PyObject *__pyx_n_s_evaluate_next;
  static PyObject *__pyx_n_s_evaluation;
  static PyObject *__pyx_n_s_exit;
  static PyObject *__pyx_n_s_exp;
  static PyObject *__pyx_kp_u_expected_Expression_Structure_tu;
  static PyObject *__pyx_n_s_expr;
  static PyObject *__pyx_n_s_expressions;
  static PyObject *__pyx_n_s_exps;
  static PyObject *__pyx_n_s_exps_dict;
  static PyObject *__pyx_n_s_extend;
  static PyObject *__pyx_n_s_extra_operators;
  static PyObject *__pyx_n_s_f;
  static PyObject *__pyx_n_u_f;
  static PyObject *__pyx_n_s_filter;
  static PyObject *__pyx_n_s_filter_leaves;
  static PyObject *__pyx_n_s_findall;
  static PyObject *__pyx_n_s_flatten;
  static PyObject *__pyx_n_s_flatten_callback;
  static PyObject *__pyx_n_s_flatten_pattern_sequence;
  static PyObject *__pyx_n_s_flatten_sequence;
  static PyObject *__pyx_n_s_flatten_sequence_2;
  static PyObject *__pyx_n_s_flattened;
  static PyObject *__pyx_n_u_float;
  static PyObject *__pyx_n_s_floordiv;
  static PyObject *__pyx_n_s_form;
  static PyObject *__pyx_n_s_format;
  static PyObject *__pyx_n_s_format_cache;
  static PyObject *__pyx_n_s_format_expr;
  static PyObject *__pyx_n_s_formats;
  static PyObject *__pyx_n_s_formatted;
  static PyObject *__pyx_kp_u_frac;
  static PyObject *__pyx_n_s_from_mpmath;
  static PyObject *__pyx_n_s_from_python;
  static PyObject *__pyx_n_s_full_atom_names;
  static PyObject *__pyx_n_s_fully;
  static PyObject *__pyx_n_s_fully_qualified_symbol_name;
  static PyObject *__pyx_n_s_func;
  static PyObject *__pyx_n_s_func_params;
  static PyObject *__pyx_n_s_functions;
  static PyObject *__pyx_n_s_functools;
  static PyObject *__pyx_n_s_ge;
  static PyObject *__pyx_n_s_genexpr;
  static PyObject *__pyx_n_s_get;
  static PyObject *__pyx_n_s_get_atom_name;
  static PyObject *__pyx_n_s_get_atoms;
  static PyObject *__pyx_n_s_get_attributes;
  static PyObject *__pyx_n_s_get_config_value;
  static PyObject *__pyx_n_s_get_default_value;
  static PyObject *__pyx_n_s_get_definition;
  static PyObject *__pyx_n_s_get_downvalues;
  static PyObject *__pyx_n_s_get_float_value;
  static PyObject *__pyx_n_s_get_formats;
  static PyObject *__pyx_n_s_get_head;
  static PyObject *__pyx_n_s_get_head_name;
  static PyObject *__pyx_n_s_get_int_value;
  static PyObject *__pyx_n_s_get_leaves;
  static PyObject *__pyx_n_s_get_lookup_name;
  static PyObject *__pyx_n_s_get_mutable_leaves;
  static PyObject *__pyx_n_s_get_name;
  static PyObject *__pyx_n_s_get_operator_display;
  static PyObject *__pyx_n_s_get_option_values;
  static PyObject *__pyx_n_s_get_options;
  static PyObject *__pyx_n_s_get_ownvalues;
  static PyObject *__pyx_n_s_get_precision;
  static PyObject *__pyx_n_s_get_rules_list;
  static PyObject *__pyx_n_s_get_scoping_vars;
  static PyObject *__pyx_n_s_get_sequence;
  static PyObject *__pyx_n_s_get_sort_key;
  static PyObject *__pyx_n_u_get_sort_key;
  static PyObject *__pyx_n_s_get_string_value;
  static PyObject *__pyx_n_s_get_subvalues;
  static PyObject *__pyx_n_s_get_type;
  static PyObject *__pyx_n_s_get_upvalues;
  static PyObject *__pyx_n_s_get_value;
  static PyObject *__pyx_n_s_get_values_list;
  static PyObject *__pyx_n_s_getnewargs;
  static PyObject *__pyx_n_s_group;
  static PyObject *__pyx_kp_u_gt;
  static PyObject *__pyx_n_s_gt_2;
  static PyObject *__pyx_n_s_h;
  static PyObject *__pyx_n_s_has_changed;
  static PyObject *__pyx_n_s_has_form;
  static PyObject *__pyx_n_s_has_symbol;
  static PyObject *__pyx_n_s_hash;
  static PyObject *__pyx_n_s_head;
  static PyObject *__pyx_n_s_head_2;
  static PyObject *__pyx_n_s_head_name;
  static PyObject *__pyx_n_s_heads;
  static PyObject *__pyx_n_u_heads;
  static PyObject *__pyx_n_s_i;
  static PyObject *__pyx_n_s_id;
  static PyObject *__pyx_n_s_imag;
  static PyObject *__pyx_n_s_imag_prec;
  static PyObject *__pyx_n_s_imag_zero;
  static PyObject *__pyx_n_u_image_size_multipliers;
  static PyObject *__pyx_n_s_import;
  static PyObject *__pyx_n_s_in_function;
  static PyObject *__pyx_n_s_in_scoping;
  static PyObject *__pyx_n_s_in_text;
  static PyObject *__pyx_n_s_inc_recursion_depth;
  static PyObject *__pyx_n_s_include_form;
  static PyObject *__pyx_n_s_include_heads;
  static PyObject *__pyx_n_s_index;
  static PyObject *__pyx_n_s_indices;
  static PyObject *__pyx_n_s_inf;
  static PyObject *__pyx_n_u_inf;
  static PyObject *__pyx_kp_u_infty;
  static PyObject *__pyx_n_s_init;
  static PyObject *__pyx_n_s_inner;
  static PyObject *__pyx_n_s_innerleaf;
  static PyObject *__pyx_n_u_inside_list;
  static PyObject *__pyx_n_s_inside_row;
  static PyObject *__pyx_n_u_inside_row;
  static PyObject *__pyx_kp_u_int;
  static PyObject *__pyx_n_u_int_2;
  static PyObject *__pyx_n_s_intersection;
  static PyObject *__pyx_n_s_is_approx_zero;
  static PyObject *__pyx_n_u_is_approx_zero;
  static PyObject *__pyx_n_s_is_atom;
  static PyObject *__pyx_n_s_is_constant;
  static PyObject *__pyx_n_s_is_free;
  static PyObject *__pyx_n_s_is_inexact;
  static PyObject *__pyx_n_s_is_list_interior;
  static PyObject *__pyx_n_s_is_list_row;
  static PyObject *__pyx_n_s_is_machine_precision;
  static PyObject *__pyx_n_s_is_neutral_head;
  static PyObject *__pyx_n_s_is_neutral_symbol;
  static PyObject *__pyx_n_s_is_neutral_symbol_locals_genexp;
  static PyObject *__pyx_n_s_is_numeric;
  static PyObject *__pyx_n_s_is_style;
  static PyObject *__pyx_n_s_is_symbol;
  static PyObject *__pyx_n_s_is_symbol_name;
  static PyObject *__pyx_n_s_is_true;
  static PyObject *__pyx_n_s_is_zero;
  static PyObject *__pyx_n_s_isinf;
  static PyObject *__pyx_n_s_isnan;
  static PyObject *__pyx_n_s_item;
  static PyObject *__pyx_n_s_item1;
  static PyObject *__pyx_n_s_item2;
  static PyObject *__pyx_n_s_item_is_free;
  static PyObject *__pyx_n_s_items;
  static PyObject *__pyx_n_s_iteration;
  static PyObject *__pyx_n_s_itertools;
  static PyObject *__pyx_n_u_itlim;
  static PyObject *__pyx_n_s_k;
  static PyObject *__pyx_n_s_key;
  static PyObject *__pyx_n_s_keys;
  static PyObject *__pyx_n_s_kwargs;
  static PyObject *__pyx_n_s_l1;
  static PyObject *__pyx_n_s_l2;
  static PyObject *__pyx_n_s_last_evaluated;
  static PyObject *__pyx_n_s_le;
  static PyObject *__pyx_n_s_leaf;
  static PyObject *__pyx_n_s_leaf_counts;
  static PyObject *__pyx_n_s_leaf_prec;
  static PyObject *__pyx_n_s_leaf_symbols;
  static PyObject *__pyx_n_s_leaves;
  static PyObject *__pyx_n_s_leaves_2;
  static PyObject *__pyx_kp_u_left_left;
  static PyObject *__pyx_kp_u_left_s;
  static PyObject *__pyx_n_s_level;
  static PyObject *__pyx_n_u_levelspec;
  static PyObject *__pyx_n_s_limit;
  static PyObject *__pyx_n_s_line;
  static PyObject *__pyx_n_s_list;
  static PyObject *__pyx_n_s_list_expr;
  static PyObject *__pyx_n_s_lookup_name;
  static PyObject *__pyx_n_s_lower;
  static PyObject *__pyx_n_s_lru_cache;
  static PyObject *__pyx_n_s_lstrip;
  static PyObject *__pyx_kp_u_lt;
  static PyObject *__pyx_n_s_lt_2;
  static PyObject *__pyx_n_s_m1;
  static PyObject *__pyx_n_s_m2;
  static PyObject *__pyx_n_s_machine_precision;
  static PyObject *__pyx_n_s_main;
  static PyObject *__pyx_n_s_make_boxes;
  static PyObject *__pyx_n_s_man;
  static PyObject *__pyx_n_s_match;
  static PyObject *__pyx_n_s_math;
  static PyObject *__pyx_kp_u_math_inf;
  static PyObject *__pyx_n_s_mathics_builtin;
  static PyObject *__pyx_n_s_mathics_builtin_base;
  static PyObject *__pyx_n_s_mathics_builtin_inout;
  static PyObject *__pyx_n_s_mathics_builtin_patterns;
  static PyObject *__pyx_n_s_mathics_builtin_scoping;
  static PyObject *__pyx_n_s_mathics_core_convert;
  static PyObject *__pyx_n_s_mathics_core_evaluation;
  static PyObject *__pyx_n_s_mathics_core_expression;
  static PyObject *__pyx_kp_s_mathics_core_expression_py;
  static PyObject *__pyx_n_s_mathics_core_numbers;
  static PyObject *__pyx_n_s_mathics_core_parser;
  static PyObject *__pyx_n_s_mathics_core_rules;
  static PyObject *__pyx_n_s_mathics_to_python;
  static PyObject *__pyx_n_s_mathics_to_sympy;
  static PyObject *__pyx_n_s_maxsize;
  static PyObject *__pyx_n_s_message;
  static PyObject *__pyx_n_s_message_args;
  static PyObject *__pyx_n_s_metaclass;
  static PyObject *__pyx_kp_u_mfrac;
  static PyObject *__pyx_kp_u_mfrac_2;
  static PyObject *__pyx_kp_u_mi_s_mi;
  static PyObject *__pyx_n_s_min;
  static PyObject *__pyx_n_s_min_key;
  static PyObject *__pyx_n_s_min_prec;
  static PyObject *__pyx_n_s_minus;
  static PyObject *__pyx_kp_u_mn_s_mn;
  static PyObject *__pyx_kp_u_mo_form_prefix_lspace_0_2em_rsp;
  static PyObject *__pyx_kp_u_mo_form_prefix_lspace_0_rspace;
  static PyObject *__pyx_kp_u_mo_s_mo;
  static PyObject *__pyx_n_s_modname;
  static PyObject *__pyx_n_s_module;
  static PyObject *__pyx_n_s_mpc;
  static PyObject *__pyx_n_s_mpf;
  static PyObject *__pyx_n_s_mpmath;
  static PyObject *__pyx_kp_u_mrow_s_mrow;
  static PyObject *__pyx_kp_u_ms_s_ms;
  static PyObject *__pyx_kp_u_mspace_linebreak_newline;
  static PyObject *__pyx_kp_u_msqrt_s_msqrt;
  static PyObject *__pyx_kp_u_msub;
  static PyObject *__pyx_kp_u_msub_2;
  static PyObject *__pyx_kp_u_msubsup;
  static PyObject *__pyx_kp_u_msubsup_2;
  static PyObject *__pyx_kp_u_msup;
  static PyObject *__pyx_kp_u_msup_2;
  static PyObject *__pyx_kp_u_mtext_s_mtext;
  static PyObject *__pyx_n_s_mul;
  static PyObject *__pyx_n_s_n;
  static PyObject *__pyx_n_s_n_evaluation;
  static PyObject *__pyx_n_u_n_evaluation;
  static PyObject *__pyx_n_s_n_expr;
  static PyObject *__pyx_n_s_n_result;
  static PyObject *__pyx_n_s_name;
  static PyObject *__pyx_n_s_name_2;
  static PyObject *__pyx_n_s_names;
  static PyObject *__pyx_kp_u_nbsp;
  static PyObject *__pyx_n_s_ne;
  static PyObject *__pyx_n_s_neg;
  static PyObject *__pyx_n_s_new;
  static PyObject *__pyx_n_s_new_2;
  static PyObject *__pyx_n_s_new_applied;
  static PyObject *__pyx_n_s_new_leaf;
  static PyObject *__pyx_n_s_new_leaves;
  static PyObject *__pyx_n_s_new_sequences;
  static PyObject *__pyx_kp_u_newline;
  static PyObject *__pyx_n_s_no_symbol;
  static PyObject *__pyx_n_s_now;
  static PyObject *__pyx_n_s_number_form;
  static PyObject *__pyx_n_s_number_form_options;
  static PyObject *__pyx_n_s_number_type;
  static PyObject *__pyx_n_s_numerator;
  static PyObject *__pyx_n_s_numerify;
  static PyObject *__pyx_n_s_object;
  static PyObject *__pyx_n_s_old;
  static PyObject *__pyx_n_s_old_options;
  static PyObject *__pyx_n_s_only_if_exists;
  static PyObject *__pyx_n_s_only_subsup;
  static PyObject *__pyx_n_s_operator;
  static PyObject *__pyx_n_s_operators;
  static PyObject *__pyx_n_s_optimize;
  static PyObject *__pyx_n_s_option;
  static PyObject *__pyx_n_s_option_values;
  static PyObject *__pyx_n_s_options;
  static PyObject *__pyx_n_u_options;
  static PyObject *__pyx_n_s_original;
  static PyObject *__pyx_n_s_origins;
  static PyObject *__pyx_n_s_other;
  static PyObject *__pyx_n_s_other_exp;
  static PyObject *__pyx_n_s_other_exps;
  static PyObject *__pyx_n_s_other_len;
  static PyObject *__pyx_n_s_other_var;
  static PyObject *__pyx_n_s_outer_precedence;
  static PyObject *__pyx_n_s_outtext;
  static PyObject *__pyx_n_u_own;
  static PyObject *__pyx_n_s_p;
  static PyObject *__pyx_n_s_parent;
  static PyObject *__pyx_n_s_parenthesize_when_equal;
  static PyObject *__pyx_n_s_parts;
  static PyObject *__pyx_n_s_pattern;
  static PyObject *__pyx_n_s_pattern_only;
  static PyObject *__pyx_n_s_pattern_sequence;
  static PyObject *__pyx_n_s_pattern_sort;
  static PyObject *__pyx_n_s_permit_complex;
  static PyObject *__pyx_n_s_pos;
  static PyObject *__pyx_n_s_pos_2;
  static PyObject *__pyx_n_s_pos_len;
  static PyObject *__pyx_n_s_position;
  static PyObject *__pyx_n_s_pow;
  static PyObject *__pyx_n_s_prec;
  static PyObject *__pyx_n_s_prec_2;
  static PyObject *__pyx_n_s_precedence;
  static PyObject *__pyx_n_s_prepare;
  static PyObject *__pyx_n_s_print_parenthesizes;
  static PyObject *__pyx_n_s_process_style_box;
  static PyObject *__pyx_kp_u_prod;
  static PyObject *__pyx_n_s_property;
  static PyObject *__pyx_n_s_py_obj;
  static PyObject *__pyx_n_s_py_slice;
  static PyObject *__pyx_n_u_python_form;
  static PyObject *__pyx_n_u_q;
  static PyObject *__pyx_n_s_qualname;
  static PyObject *__pyx_kp_u_quot;
  static PyObject *__pyx_n_s_r;
  static PyObject *__pyx_n_s_range;
  static PyObject *__pyx_n_s_re;
  static PyObject *__pyx_n_s_real;
  static PyObject *__pyx_n_s_real_prec;
  static PyObject *__pyx_n_s_real_zero;
  static PyObject *__pyx_n_s_rebuild_cache;
  static PyObject *__pyx_n_s_reevaluate;
  static PyObject *__pyx_n_s_rel_eps;
  static PyObject *__pyx_n_s_render;
  static PyObject *__pyx_n_s_reordered;
  static PyObject *__pyx_n_s_repl;
  static PyObject *__pyx_n_s_replace;
  static PyObject *__pyx_n_s_replace_slots;
  static PyObject *__pyx_n_s_replace_vars;
  static PyObject *__pyx_n_s_replacement;
  static PyObject *__pyx_n_s_repr;
  static PyObject *__pyx_n_s_res;
  static PyObject *__pyx_n_s_rest_range;
  static PyObject *__pyx_n_s_restructure;
  static PyObject *__pyx_n_s_result;
  static PyObject *__pyx_n_s_ret;
  static PyObject *__pyx_n_s_return;
  static PyObject *__pyx_n_s_reversed;
  static PyObject *__pyx_n_s_rhs;
  static PyObject *__pyx_kp_u_right_right;
  static PyObject *__pyx_kp_u_right_s;
  static PyObject *__pyx_n_s_rindex;
  static PyObject *__pyx_n_s_round;
  static PyObject *__pyx_n_s_round_to_float;
  static PyObject *__pyx_n_s_rule;
  static PyObject *__pyx_n_s_rules;
  static PyObject *__pyx_n_s_rules_names;
  static PyObject *__pyx_kp_u_s;
  static PyObject *__pyx_kp_u_s_2;
  static PyObject *__pyx_kp_u_s_3;
  static PyObject *__pyx_kp_u_s_4;
  static PyObject *__pyx_kp_u_s_5;
  static PyObject *__pyx_n_s_s_6;
  static PyObject *__pyx_kp_u_s_s;
  static PyObject *__pyx_n_s_sameQ;
  static PyObject *__pyx_n_s_scoping_vars;
  static PyObject *__pyx_n_s_self;
  static PyObject *__pyx_n_s_self_exp;
  static PyObject *__pyx_n_s_self_exps;
  static PyObject *__pyx_n_s_self_len;
  static PyObject *__pyx_n_s_self_var;
  static PyObject *__pyx_n_s_send;
  static PyObject *__pyx_n_s_seq;
  static PyObject *__pyx_n_s_sequence;
  static PyObject *__pyx_n_s_sequences;
  static PyObject *__pyx_n_s_sequences_2;
  static PyObject *__pyx_n_s_set_head;
  static PyObject *__pyx_n_s_set_leaf;
  static PyObject *__pyx_n_s_set_positions;
  static PyObject *__pyx_n_s_set_reordered_leaves;
  static PyObject *__pyx_n_s_setter;
  static PyObject *__pyx_n_s_shallow_copy;
  static PyObject *__pyx_n_s_shorten_name;
  static PyObject *__pyx_n_s_show_string_characters;
  static PyObject *__pyx_n_u_show_string_characters;
  static PyObject *__pyx_kp_u_sim;
  static PyObject *__pyx_kp_u_sim_2;
  static PyObject *__pyx_n_s_slice;
  static PyObject *__pyx_n_s_sliced;
  static PyObject *__pyx_n_s_slot;
  static PyObject *__pyx_n_u_slot;
  static PyObject *__pyx_n_u_slotn;
  static PyObject *__pyx_n_s_slots;
  static PyObject *__pyx_n_s_sort;
  static PyObject *__pyx_n_s_split;
  static PyObject *__pyx_kp_u_sqrt_s;
  static PyObject *__pyx_n_s_startswith;
  static PyObject *__pyx_n_s_staticmethod;
  static PyObject *__pyx_n_s_step;
  static PyObject *__pyx_n_s_stop_on_error;
  static PyObject *__pyx_n_s_str;
  static PyObject *__pyx_n_s_string;
  static PyObject *__pyx_n_s_string_list;
  static PyObject *__pyx_n_u_string_quotes;
  static PyObject *__pyx_n_s_strip_context;
  static PyObject *__pyx_n_s_structure;
  static PyObject *__pyx_n_s_structure_cache;
  static PyObject *__pyx_n_s_sub;
  static PyObject *__pyx_n_u_sub;
  static PyObject *__pyx_n_s_sub_2;
  static PyObject *__pyx_n_s_sub_applied;
  static PyObject *__pyx_n_s_sub_level;
  static PyObject *__pyx_kp_u_sum;
  static PyObject *__pyx_n_s_sup_string;
  static PyObject *__pyx_n_s_super;
  static PyObject *__pyx_n_s_sym;
  static PyObject *__pyx_n_s_sym_args;
  static PyObject *__pyx_n_s_symbol_name;
  static PyObject *__pyx_n_s_symbolname;
  static PyObject *__pyx_n_s_symbols;
  static PyObject *__pyx_n_s_sympy;
  static PyObject *__pyx_kp_u_sympy_2;
  static PyObject *__pyx_n_s_sympy_dummy;
  static PyObject *__pyx_n_s_sympy_expr;
  static PyObject *__pyx_n_s_sympy_name;
  static PyObject *__pyx_n_s_sympy_symbol_prefix;
  static PyObject *__pyx_n_s_system_symbols;
  static PyObject *__pyx_n_s_system_symbols_dict;
  static PyObject *__pyx_n_u_tdlen;
  static PyObject *__pyx_n_s_test;
  static PyObject *__pyx_n_s_tex;
  static PyObject *__pyx_n_u_tex;
  static PyObject *__pyx_n_s_tex1;
  static PyObject *__pyx_n_s_text;
  static PyObject *__pyx_n_u_text;
  static PyObject *__pyx_kp_u_text_s;
  static PyObject *__pyx_kp_u_text_s_2;
  static PyObject *__pyx_n_s_thread;
  static PyObject *__pyx_n_s_threaded;
  static PyObject *__pyx_n_s_throw;
  static PyObject *__pyx_n_s_time;
  static PyObject *__pyx_n_s_timeout;
  static PyObject *__pyx_kp_u_times;
  static PyObject *__pyx_n_s_timestamp_cache;
  static PyObject *__pyx_n_s_to_mpmath;
  static PyObject *__pyx_n_s_to_python;
  static PyObject *__pyx_n_s_to_sympy;
  static PyObject *__pyx_n_s_truediv;
  static PyObject *__pyx_kp_u_type;
  static PyObject *__pyx_n_s_typing;
  static PyObject *__pyx_n_s_unevaluated;
  static PyObject *__pyx_n_s_unformatted;
  static PyObject *__pyx_n_u_unicode;
  static PyObject *__pyx_n_s_union;
  static PyObject *__pyx_n_u_up;
  static PyObject *__pyx_n_s_update;
  static PyObject *__pyx_n_s_upper;
  static PyObject *__pyx_n_s_user;
  static PyObject *__pyx_n_s_user_hash;
  static PyObject *__pyx_n_u_utf8;
  static PyObject *__pyx_kp_u_utf_8;
  static PyObject *__pyx_n_s_v;
  static PyObject *__pyx_n_s_valid_context_name;
  static PyObject *__pyx_n_s_value;
  static PyObject *__pyx_kp_u_value_does_not_belongs_to_a_vali;
  static PyObject *__pyx_n_s_values;
  static PyObject *__pyx_n_s_var;
  static PyObject *__pyx_n_s_vars;
  static PyObject *__pyx_kp_u_vert;
  static PyObject *__pyx_kp_u_vert_2;
  static PyObject *__pyx_kp_u_wedge;
  static PyObject *__pyx_kp_u_wedge_2;
  static PyObject *__pyx_n_s_workprec;
  static PyObject *__pyx_n_u_xml;
  static PyObject *__pyx_n_u_z;
  static PyObject *__pyx_n_s_zfill;
  static PyObject *__pyx_n_s_zip;
static PyObject *__pyx_pf_7mathics_4core_10expression_fully_qualified_symbol_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_2valid_context_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ctx, PyObject *__pyx_v_allow_initial_backquote); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4ensure_context(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name, PyObject *__pyx_v_context); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6strip_context(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8system_symbols(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_symbols); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10system_symbols_dict(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8BoxError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_box, PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_17ExpressionPointer___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_parent, PyObject *__pyx_v_position); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_17ExpressionPointer_2replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_new); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_17ExpressionPointer_4__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_12from_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arg); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_2__lt__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_4__gt__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_6__le__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_8__ge__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_10__eq__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_12__ne__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_time, PyObject *__pyx_v_symbols, PyObject *__pyx_v_sequences, PyObject *__pyx_v_copy); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache_2copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache_6sliced_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache_4sliced(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_lower, PyObject *__pyx_v_upper); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache_6reordered(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache_8union(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_expressions, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_2clear_cache(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_4equal2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_6has_changed(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_definitions); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_8sequences(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_10flatten_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_12flatten_pattern_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_14get_attributes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_definitions); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_16evaluate_next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_18evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_20get_atoms(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_include_heads); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_22get_name(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_24is_symbol(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_26is_machine_precision(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_28get_lookup_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_30get_head(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_32get_head_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_34get_leaves(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_36get_int_value(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_38get_float_value(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_permit_complex); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_40get_string_value(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_42is_atom(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_44is_true(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_46is_numeric(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_48has_form(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_heads, CYTHON_UNUSED PyObject *__pyx_v_leaf_counts); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_50flatten(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_head, CYTHON_UNUSED PyObject *__pyx_v_pattern_only, CYTHON_UNUSED PyObject *__pyx_v_callback); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_52__hash__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_54user_hash(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_update); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_56sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_58get_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_60evaluate_leaves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_62apply_rules(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rules, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_level, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_9do_format_format_expr(PyObject *__pyx_self, PyObject *__pyx_v_expr); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_64do_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_66format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_68is_free(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_form, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_70is_inexact(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_72get_precision(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_74get_option_values(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_allow_symbols, PyObject *__pyx_v_stop_on_error); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_76get_rules_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_78to_sympy(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_80to_mpmath(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_82round_to_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_permit_complex); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_84__abs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_86__pos__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_88__neg__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_90__add__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_92__sub__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_94__mul__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_96__truediv__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_98__floordiv__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_100__pow__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_exps_dict); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_2__lt__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_4__gt__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_6__le__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_8__ge__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_10__eq__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_12__ne__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_5__cmp_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_5__cmp_3genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_14__cmp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_7__new___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_head, PyObject *__pyx_v_leaves, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_2head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_4head(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_6leaves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_8leaves(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_10equal2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_12slice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head, PyObject *__pyx_v_py_slice, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_14filter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head, PyObject *__pyx_v_cond, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_16restructure(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head, PyObject *__pyx_v_leaves, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_structure_cache, PyObject *__pyx_v_deps); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_18_no_symbol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_symbol_name); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_20sequences(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_22_flatten_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_sequence, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_16flatten_sequence_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_leaf); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_24flatten_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_24flatten_pattern_sequence_sequence(PyObject *__pyx_self, PyObject *__pyx_v_leaf); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_26flatten_pattern_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_28_rebuild_cache(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_30has_changed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_definitions); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_32_timestamp_cache(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_4copy_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_34copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reevaluate); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_36do_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_38shallow_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_40set_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_position); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_42get_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_44set_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_46get_leaves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_48get_mutable_leaves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_50set_leaf(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_52set_reordered_leaves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_leaves); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_14get_attributes_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_54get_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_definitions); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_56get_lookup_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_58has_form(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_heads, PyObject *__pyx_v_leaf_counts); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_10has_symbol_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_60has_symbol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_symbol_name); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_62_as_sympy_function(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_64to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_66to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_12get_sort_key_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_12get_sort_key_3genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_68get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pattern_sort); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_70sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_72flatten(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head, PyObject *__pyx_v_pattern_only, PyObject *__pyx_v_callback, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_74evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_rest_range(PyObject *__pyx_self, PyObject *__pyx_v_indices); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_2eval_range(PyObject *__pyx_self, PyObject *__pyx_v_indices); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_4flatten_callback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_new_leaves, PyObject *__pyx_v_old); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_6rules(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_76evaluate_next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_78evaluate_leaves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_80__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_82__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_84process_style_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_86boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_15boxes_to_mathml_16is_list_interior_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_15boxes_to_mathml_is_list_interior(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_content); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_88boxes_to_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_12boxes_to_tex_block(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tex, PyObject *__pyx_v_only_subsup); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_90boxes_to_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_92default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda10(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_e); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_94sort(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_96filter_leaves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head_name); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_11apply_rules_apply_leaf(PyObject *__pyx_self, PyObject *__pyx_v_leaf); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_11apply_rules_2descend(PyObject *__pyx_self, PyObject *__pyx_v_expr); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_98apply_rules(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rules, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_level, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_12replace_vars_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_100replace_vars(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_vars, PyObject *__pyx_v_options, PyObject *__pyx_v_in_scoping, PyObject *__pyx_v_in_function); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_102replace_slots(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_slots, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_104thread(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_head); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_10is_numeric_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_106is_numeric(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_108numerify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_110get_atoms(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_include_heads); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_112__hash__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_114user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_116__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_is_atom(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_2equal2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_4has_form(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_heads, PyObject *__pyx_v_leaf_counts); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_6has_symbol(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_symbol_name); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_8get_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_10get_atom_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_12__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_14replace_vars(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_vars, CYTHON_UNUSED PyObject *__pyx_v_options, CYTHON_UNUSED PyObject *__pyx_v_in_scoping); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_16replace_slots(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_slots, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_18numerify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_20copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_reevaluate); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_22set_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_position); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_24get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_pattern_sort); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_26get_atoms(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_include_heads); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_28atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_name, PyObject *__pyx_v_sympy_dummy); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_4do_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_6boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_8atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_f, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_10to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_12to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_14default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation, CYTHON_UNUSED PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_16get_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_definitions); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_18get_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_20is_symbol(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_22get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pattern_sort); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_24equal2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_26sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_38__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_12replace_vars_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_28replace_vars(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_vars, CYTHON_UNUSED PyObject *__pyx_v_options, CYTHON_UNUSED PyObject *__pyx_v_in_scoping); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_30has_symbol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_symbol_name); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_32evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_34is_true(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_36is_numeric(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_38__hash__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_40user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_42__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_14from_mpmath(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value, PyObject *__pyx_v_prec); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Number___str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6Number_2is_numeric(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_16_ExponentFunction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_18_NumberFormat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_man, PyObject *__pyx_v_base, PyObject *__pyx_v_exp, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_2__init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_4boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_6boxes_to_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_8boxes_to_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_10make_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_12atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_14default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation, CYTHON_UNUSED PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_16to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_18to_mpmath(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_20to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_22round(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_24get_int_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_26sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_28evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_30get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pattern_sort); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_32do_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_34__hash__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_36user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_38__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_40__neg__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_42is_zero(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_numerator, PyObject *__pyx_v_denominator); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_2atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_4to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_6to_mpmath(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_8to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_10round(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_12sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_14numerator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_16denominator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_18do_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_20default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation, CYTHON_UNUSED PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_22evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_24get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pattern_sort); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_26do_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_28__hash__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_30user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_32__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_34__neg__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_36is_zero(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real___new__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_cls, PyObject *__pyx_v_value, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_2boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_4boxes_to_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_6boxes_to_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_8atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_10evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_12get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pattern_sort); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_14__eq__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_16__ne__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_18__hash__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_20user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_22get_atom_name(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_2to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_4to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_6to_mpmath(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_8round(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_10sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_12is_machine_precision(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_14get_precision(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_16get_float_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_permit_complex); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_18make_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_20__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_22do_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_24__neg__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_26is_zero(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_28is_approx_zero(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_2to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_4to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_6to_mpmath(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_8round(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_10sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_12get_precision(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_14make_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_16__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_18do_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_20__neg__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_22is_zero(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_real, PyObject *__pyx_v_imag); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_2atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_4__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_6to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_8to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_10to_mpmath(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_12do_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_14default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_16get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pattern_sort); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_18sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_20evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_22round(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_24is_machine_precision(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_26get_float_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_permit_complex); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_28get_precision(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_30do_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_32__hash__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_34user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_36__eq__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_38__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_40__neg__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_42is_zero(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_44is_approx_zero(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_20encode_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_10encode_tex_replace(PyObject *__pyx_self, PyObject *__pyx_v_match); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_22encode_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_in_text); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_4boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_show_string_characters, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_format, PyObject *__pyx_v_string); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_6boxes_to_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_show_string_characters, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_12boxes_to_tex_render(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_format, PyObject *__pyx_v_string, PyObject *__pyx_v_in_text); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_8boxes_to_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_show_string_characters, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_10atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_12do_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_14default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation, CYTHON_UNUSED PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_16get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pattern_sort); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_18sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_20get_string_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_22to_sympy(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_24to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_26__hash__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_28user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_6String_30__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_4boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_6boxes_to_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_8boxes_to_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_10atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_12do_copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_14default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation, CYTHON_UNUSED PyObject *__pyx_v_form); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_16get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pattern_sort); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_18sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_20get_string_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_22to_sympy(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_24to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_26__hash__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_28user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_30__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_16StringFromPython___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_24get_default_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_k, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_26print_parenthesizes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_precedence, PyObject *__pyx_v_outer_precedence, PyObject *__pyx_v_parenthesize_when_equal); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_18_is_neutral_symbol_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_28_is_neutral_symbol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_symbol_name, PyObject *__pyx_v_cache, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_30_is_neutral_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_head, PyObject *__pyx_v_cache, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_9Structure___call__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_leaves); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_9Structure_2filter(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_expr, CYTHON_UNUSED PyObject *__pyx_v_cond); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_9Structure_4slice(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_expr, CYTHON_UNUSED PyObject *__pyx_v_py_slice); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_17UnlinkedStructure___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_17UnlinkedStructure_2__call__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_leaves); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_17UnlinkedStructure_4filter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_cond); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_17UnlinkedStructure_6slice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_py_slice); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_15LinkedStructure___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head, PyObject *__pyx_v_cache); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_15LinkedStructure_2__call__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_leaves); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_15LinkedStructure_4filter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_cond); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_15LinkedStructure_6slice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_py_slice); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_32structure(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_head, PyObject *__pyx_v_origins, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_structure_cache); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_21atom_list_constructor_construct(PyObject *__pyx_self, PyObject *__pyx_v_leaves); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_21atom_list_constructor_2construct(PyObject *__pyx_self, PyObject *__pyx_v_leaves); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_21atom_list_constructor_4genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_21atom_list_constructor_7genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_34atom_list_constructor(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_head, PyObject *__pyx_v_atom_names); /* proto */
static PyObject *__pyx_pf_7mathics_4core_10expression_36string_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_head, PyObject *__pyx_v_leaves, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct__sliced(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_2_do_format(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_3___cmp(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_6___new__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_9_copy(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_10_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_12_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_14_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_16_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_17_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_19_rules(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_21_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_24_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_26_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_28_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_31_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_33_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_34_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_update = {0, &__pyx_n_s_update, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PySet_Type_intersection = {0, &__pyx_n_s_intersection, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PySet_Type_update = {0, &__pyx_n_s_update, 0, 0, 0};
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_float_0_5;
static PyObject *__pyx_float_1eneg_10;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_7;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_20;
static PyObject *__pyx_int_40;
static PyObject *__pyx_int_50;
static PyObject *__pyx_int_170;
static PyObject *__pyx_int_1024;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_neg_5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_slice__37;
static PyObject *__pyx_slice__47;
static PyObject *__pyx_slice__66;
static PyObject *__pyx_slice__85;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__109;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__113;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__115;
static PyObject *__pyx_tuple__117;
static PyObject *__pyx_tuple__119;
static PyObject *__pyx_tuple__121;
static PyObject *__pyx_tuple__123;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__127;
static PyObject *__pyx_tuple__129;
static PyObject *__pyx_tuple__131;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_tuple__136;
static PyObject *__pyx_tuple__138;
static PyObject *__pyx_tuple__140;
static PyObject *__pyx_tuple__142;
static PyObject *__pyx_tuple__144;
static PyObject *__pyx_tuple__145;
static PyObject *__pyx_tuple__147;
static PyObject *__pyx_tuple__149;
static PyObject *__pyx_tuple__151;
static PyObject *__pyx_tuple__153;
static PyObject *__pyx_tuple__155;
static PyObject *__pyx_tuple__157;
static PyObject *__pyx_tuple__159;
static PyObject *__pyx_tuple__161;
static PyObject *__pyx_tuple__162;
static PyObject *__pyx_tuple__164;
static PyObject *__pyx_tuple__166;
static PyObject *__pyx_tuple__168;
static PyObject *__pyx_tuple__170;
static PyObject *__pyx_tuple__172;
static PyObject *__pyx_tuple__174;
static PyObject *__pyx_tuple__176;
static PyObject *__pyx_tuple__178;
static PyObject *__pyx_tuple__180;
static PyObject *__pyx_tuple__182;
static PyObject *__pyx_tuple__184;
static PyObject *__pyx_tuple__186;
static PyObject *__pyx_tuple__188;
static PyObject *__pyx_tuple__190;
static PyObject *__pyx_tuple__192;
static PyObject *__pyx_tuple__193;
static PyObject *__pyx_tuple__195;
static PyObject *__pyx_tuple__197;
static PyObject *__pyx_tuple__199;
static PyObject *__pyx_tuple__201;
static PyObject *__pyx_tuple__203;
static PyObject *__pyx_tuple__205;
static PyObject *__pyx_tuple__207;
static PyObject *__pyx_tuple__209;
static PyObject *__pyx_tuple__211;
static PyObject *__pyx_tuple__212;
static PyObject *__pyx_tuple__214;
static PyObject *__pyx_tuple__216;
static PyObject *__pyx_tuple__218;
static PyObject *__pyx_tuple__220;
static PyObject *__pyx_tuple__222;
static PyObject *__pyx_tuple__224;
static PyObject *__pyx_tuple__225;
static PyObject *__pyx_tuple__227;
static PyObject *__pyx_tuple__229;
static PyObject *__pyx_tuple__231;
static PyObject *__pyx_tuple__233;
static PyObject *__pyx_tuple__235;
static PyObject *__pyx_tuple__237;
static PyObject *__pyx_tuple__238;
static PyObject *__pyx_tuple__240;
static PyObject *__pyx_tuple__242;
static PyObject *__pyx_tuple__243;
static PyObject *__pyx_tuple__245;
static PyObject *__pyx_tuple__247;
static PyObject *__pyx_tuple__249;
static PyObject *__pyx_tuple__251;
static PyObject *__pyx_tuple__252;
static PyObject *__pyx_tuple__254;
static PyObject *__pyx_tuple__256;
static PyObject *__pyx_tuple__258;
static PyObject *__pyx_tuple__260;
static PyObject *__pyx_tuple__261;
static PyObject *__pyx_tuple__263;
static PyObject *__pyx_tuple__265;
static PyObject *__pyx_tuple__267;
static PyObject *__pyx_tuple__269;
static PyObject *__pyx_tuple__271;
static PyObject *__pyx_tuple__273;
static PyObject *__pyx_tuple__275;
static PyObject *__pyx_tuple__277;
static PyObject *__pyx_tuple__279;
static PyObject *__pyx_tuple__280;
static PyObject *__pyx_tuple__282;
static PyObject *__pyx_tuple__284;
static PyObject *__pyx_tuple__286;
static PyObject *__pyx_tuple__288;
static PyObject *__pyx_tuple__290;
static PyObject *__pyx_tuple__292;
static PyObject *__pyx_tuple__294;
static PyObject *__pyx_tuple__296;
static PyObject *__pyx_tuple__298;
static PyObject *__pyx_tuple__300;
static PyObject *__pyx_tuple__302;
static PyObject *__pyx_tuple__304;
static PyObject *__pyx_tuple__306;
static PyObject *__pyx_tuple__308;
static PyObject *__pyx_tuple__310;
static PyObject *__pyx_tuple__312;
static PyObject *__pyx_tuple__314;
static PyObject *__pyx_tuple__315;
static PyObject *__pyx_tuple__317;
static PyObject *__pyx_tuple__319;
static PyObject *__pyx_tuple__321;
static PyObject *__pyx_tuple__323;
static PyObject *__pyx_tuple__325;
static PyObject *__pyx_tuple__327;
static PyObject *__pyx_tuple__329;
static PyObject *__pyx_tuple__331;
static PyObject *__pyx_tuple__333;
static PyObject *__pyx_tuple__334;
static PyObject *__pyx_tuple__336;
static PyObject *__pyx_tuple__338;
static PyObject *__pyx_tuple__340;
static PyObject *__pyx_tuple__341;
static PyObject *__pyx_tuple__343;
static PyObject *__pyx_tuple__345;
static PyObject *__pyx_tuple__347;
static PyObject *__pyx_tuple__349;
static PyObject *__pyx_tuple__351;
static PyObject *__pyx_tuple__353;
static PyObject *__pyx_tuple__355;
static PyObject *__pyx_tuple__357;
static PyObject *__pyx_tuple__359;
static PyObject *__pyx_tuple__361;
static PyObject *__pyx_tuple__363;
static PyObject *__pyx_tuple__365;
static PyObject *__pyx_tuple__367;
static PyObject *__pyx_tuple__369;
static PyObject *__pyx_tuple__370;
static PyObject *__pyx_tuple__372;
static PyObject *__pyx_tuple__374;
static PyObject *__pyx_tuple__375;
static PyObject *__pyx_tuple__377;
static PyObject *__pyx_tuple__379;
static PyObject *__pyx_tuple__381;
static PyObject *__pyx_tuple__383;
static PyObject *__pyx_tuple__385;
static PyObject *__pyx_tuple__387;
static PyObject *__pyx_tuple__389;
static PyObject *__pyx_tuple__391;
static PyObject *__pyx_tuple__393;
static PyObject *__pyx_tuple__395;
static PyObject *__pyx_tuple__397;
static PyObject *__pyx_tuple__398;
static PyObject *__pyx_tuple__400;
static PyObject *__pyx_tuple__402;
static PyObject *__pyx_tuple__403;
static PyObject *__pyx_tuple__405;
static PyObject *__pyx_tuple__406;
static PyObject *__pyx_tuple__408;
static PyObject *__pyx_tuple__410;
static PyObject *__pyx_tuple__411;
static PyObject *__pyx_tuple__413;
static PyObject *__pyx_tuple__415;
static PyObject *__pyx_tuple__417;
static PyObject *__pyx_tuple__418;
static PyObject *__pyx_tuple__420;
static PyObject *__pyx_tuple__422;
static PyObject *__pyx_tuple__424;
static PyObject *__pyx_tuple__426;
static PyObject *__pyx_tuple__428;
static PyObject *__pyx_tuple__430;
static PyObject *__pyx_tuple__432;
static PyObject *__pyx_tuple__434;
static PyObject *__pyx_tuple__436;
static PyObject *__pyx_tuple__438;
static PyObject *__pyx_tuple__440;
static PyObject *__pyx_tuple__441;
static PyObject *__pyx_tuple__443;
static PyObject *__pyx_tuple__445;
static PyObject *__pyx_tuple__447;
static PyObject *__pyx_tuple__448;
static PyObject *__pyx_tuple__450;
static PyObject *__pyx_tuple__451;
static PyObject *__pyx_tuple__453;
static PyObject *__pyx_tuple__454;
static PyObject *__pyx_tuple__456;
static PyObject *__pyx_tuple__457;
static PyObject *__pyx_tuple__459;
static PyObject *__pyx_tuple__461;
static PyObject *__pyx_tuple__462;
static PyObject *__pyx_tuple__464;
static PyObject *__pyx_tuple__466;
static PyObject *__pyx_tuple__468;
static PyObject *__pyx_tuple__470;
static PyObject *__pyx_tuple__472;
static PyObject *__pyx_tuple__474;
static PyObject *__pyx_tuple__476;
static PyObject *__pyx_tuple__478;
static PyObject *__pyx_tuple__480;
static PyObject *__pyx_tuple__482;
static PyObject *__pyx_tuple__484;
static PyObject *__pyx_tuple__485;
static PyObject *__pyx_tuple__487;
static PyObject *__pyx_tuple__489;
static PyObject *__pyx_tuple__491;
static PyObject *__pyx_tuple__493;
static PyObject *__pyx_tuple__495;
static PyObject *__pyx_tuple__497;
static PyObject *__pyx_tuple__499;
static PyObject *__pyx_tuple__501;
static PyObject *__pyx_tuple__503;
static PyObject *__pyx_tuple__505;
static PyObject *__pyx_tuple__506;
static PyObject *__pyx_tuple__507;
static PyObject *__pyx_tuple__508;
static PyObject *__pyx_tuple__509;
static PyObject *__pyx_tuple__510;
static PyObject *__pyx_tuple__511;
static PyObject *__pyx_tuple__512;
static PyObject *__pyx_tuple__513;
static PyObject *__pyx_tuple__514;
static PyObject *__pyx_tuple__515;
static PyObject *__pyx_tuple__516;
static PyObject *__pyx_tuple__517;
static PyObject *__pyx_tuple__518;
static PyObject *__pyx_tuple__519;
static PyObject *__pyx_tuple__520;
static PyObject *__pyx_tuple__521;
static PyObject *__pyx_tuple__523;
static PyObject *__pyx_tuple__524;
static PyObject *__pyx_tuple__526;
static PyObject *__pyx_tuple__528;
static PyObject *__pyx_tuple__530;
static PyObject *__pyx_tuple__533;
static PyObject *__pyx_tuple__535;
static PyObject *__pyx_tuple__537;
static PyObject *__pyx_tuple__539;
static PyObject *__pyx_tuple__541;
static PyObject *__pyx_tuple__543;
static PyObject *__pyx_tuple__545;
static PyObject *__pyx_tuple__547;
static PyObject *__pyx_tuple__549;
static PyObject *__pyx_tuple__551;
static PyObject *__pyx_tuple__553;
static PyObject *__pyx_tuple__555;
static PyObject *__pyx_tuple__557;
static PyObject *__pyx_tuple__558;
static PyObject *__pyx_tuple__559;
static PyObject *__pyx_tuple__561;
static PyObject *__pyx_tuple__563;
static PyObject *__pyx_tuple__565;
static PyObject *__pyx_tuple__567;
static PyObject *__pyx_tuple__568;
static PyObject *__pyx_tuple__570;
static PyObject *__pyx_tuple__572;
static PyObject *__pyx_tuple__574;
static PyObject *__pyx_tuple__576;
static PyObject *__pyx_tuple__578;
static PyObject *__pyx_tuple__580;
static PyObject *__pyx_tuple__581;
static PyObject *__pyx_tuple__582;
static PyObject *__pyx_tuple__584;
static PyObject *__pyx_tuple__585;
static PyObject *__pyx_tuple__587;
static PyObject *__pyx_tuple__589;
static PyObject *__pyx_tuple__591;
static PyObject *__pyx_tuple__593;
static PyObject *__pyx_tuple__595;
static PyObject *__pyx_tuple__596;
static PyObject *__pyx_tuple__598;
static PyObject *__pyx_tuple__600;
static PyObject *__pyx_tuple__602;
static PyObject *__pyx_tuple__604;
static PyObject *__pyx_tuple__606;
static PyObject *__pyx_tuple__608;
static PyObject *__pyx_tuple__610;
static PyObject *__pyx_tuple__611;
static PyObject *__pyx_tuple__613;
static PyObject *__pyx_tuple__615;
static PyObject *__pyx_tuple__617;
static PyObject *__pyx_tuple__619;
static PyObject *__pyx_tuple__621;
static PyObject *__pyx_tuple__623;
static PyObject *__pyx_tuple__624;
static PyObject *__pyx_tuple__626;
static PyObject *__pyx_tuple__627;
static PyObject *__pyx_tuple__629;
static PyObject *__pyx_tuple__631;
static PyObject *__pyx_tuple__633;
static PyObject *__pyx_tuple__635;
static PyObject *__pyx_tuple__637;
static PyObject *__pyx_tuple__639;
static PyObject *__pyx_tuple__640;
static PyObject *__pyx_tuple__642;
static PyObject *__pyx_tuple__644;
static PyObject *__pyx_tuple__646;
static PyObject *__pyx_tuple__648;
static PyObject *__pyx_tuple__650;
static PyObject *__pyx_tuple__652;
static PyObject *__pyx_tuple__654;
static PyObject *__pyx_tuple__656;
static PyObject *__pyx_tuple__658;
static PyObject *__pyx_tuple__660;
static PyObject *__pyx_tuple__661;
static PyObject *__pyx_tuple__663;
static PyObject *__pyx_tuple__665;
static PyObject *__pyx_tuple__667;
static PyObject *__pyx_tuple__669;
static PyObject *__pyx_tuple__670;
static PyObject *__pyx_tuple__672;
static PyObject *__pyx_tuple__674;
static PyObject *__pyx_tuple__676;
static PyObject *__pyx_tuple__678;
static PyObject *__pyx_tuple__680;
static PyObject *__pyx_tuple__682;
static PyObject *__pyx_tuple__684;
static PyObject *__pyx_tuple__686;
static PyObject *__pyx_tuple__688;
static PyObject *__pyx_tuple__690;
static PyObject *__pyx_tuple__692;
static PyObject *__pyx_tuple__693;
static PyObject *__pyx_tuple__695;
static PyObject *__pyx_tuple__697;
static PyObject *__pyx_tuple__699;
static PyObject *__pyx_tuple__701;
static PyObject *__pyx_tuple__703;
static PyObject *__pyx_tuple__705;
static PyObject *__pyx_tuple__707;
static PyObject *__pyx_tuple__709;
static PyObject *__pyx_tuple__711;
static PyObject *__pyx_tuple__713;
static PyObject *__pyx_tuple__715;
static PyObject *__pyx_tuple__717;
static PyObject *__pyx_tuple__719;
static PyObject *__pyx_tuple__721;
static PyObject *__pyx_tuple__723;
static PyObject *__pyx_tuple__725;
static PyObject *__pyx_tuple__726;
static PyObject *__pyx_tuple__728;
static PyObject *__pyx_tuple__730;
static PyObject *__pyx_tuple__732;
static PyObject *__pyx_tuple__733;
static PyObject *__pyx_tuple__735;
static PyObject *__pyx_tuple__737;
static PyObject *__pyx_tuple__738;
static PyObject *__pyx_tuple__740;
static PyObject *__pyx_tuple__742;
static PyObject *__pyx_tuple__744;
static PyObject *__pyx_tuple__746;
static PyObject *__pyx_tuple__748;
static PyObject *__pyx_tuple__750;
static PyObject *__pyx_tuple__752;
static PyObject *__pyx_tuple__754;
static PyObject *__pyx_tuple__756;
static PyObject *__pyx_tuple__773;
static PyObject *__pyx_tuple__775;
static PyObject *__pyx_tuple__776;
static PyObject *__pyx_tuple__778;
static PyObject *__pyx_tuple__780;
static PyObject *__pyx_tuple__782;
static PyObject *__pyx_tuple__783;
static PyObject *__pyx_tuple__785;
static PyObject *__pyx_tuple__786;
static PyObject *__pyx_tuple__788;
static PyObject *__pyx_tuple__789;
static PyObject *__pyx_tuple__791;
static PyObject *__pyx_tuple__793;
static PyObject *__pyx_tuple__795;
static PyObject *__pyx_tuple__797;
static PyObject *__pyx_tuple__798;
static PyObject *__pyx_tuple__800;
static PyObject *__pyx_tuple__802;
static PyObject *__pyx_tuple__804;
static PyObject *__pyx_tuple__806;
static PyObject *__pyx_tuple__808;
static PyObject *__pyx_tuple__810;
static PyObject *__pyx_tuple__812;
static PyObject *__pyx_tuple__814;
static PyObject *__pyx_tuple__816;
static PyObject *__pyx_tuple__818;
static PyObject *__pyx_tuple__820;
static PyObject *__pyx_tuple__822;
static PyObject *__pyx_tuple__824;
static PyObject *__pyx_tuple__826;
static PyObject *__pyx_tuple__828;
static PyObject *__pyx_tuple__830;
static PyObject *__pyx_tuple__831;
static PyObject *__pyx_tuple__833;
static PyObject *__pyx_tuple__835;
static PyObject *__pyx_tuple__837;
static PyObject *__pyx_tuple__839;
static PyObject *__pyx_tuple__841;
static PyObject *__pyx_tuple__843;
static PyObject *__pyx_tuple__845;
static PyObject *__pyx_tuple__847;
static PyObject *__pyx_tuple__849;
static PyObject *__pyx_tuple__850;
static PyObject *__pyx_tuple__852;
static PyObject *__pyx_tuple__853;
static PyObject *__pyx_tuple__855;
static PyObject *__pyx_tuple__857;
static PyObject *__pyx_tuple__858;
static PyObject *__pyx_tuple__860;
static PyObject *__pyx_tuple__862;
static PyObject *__pyx_tuple__864;
static PyObject *__pyx_tuple__866;
static PyObject *__pyx_tuple__868;
static PyObject *__pyx_tuple__870;
static PyObject *__pyx_tuple__872;
static PyObject *__pyx_tuple__874;
static PyObject *__pyx_tuple__876;
static PyObject *__pyx_tuple__878;
static PyObject *__pyx_tuple__880;
static PyObject *__pyx_tuple__882;
static PyObject *__pyx_tuple__883;
static PyObject *__pyx_tuple__885;
static PyObject *__pyx_codeobj__10;
static PyObject *__pyx_codeobj__17;
static PyObject *__pyx_codeobj__19;
static PyObject *__pyx_codeobj__26;
static PyObject *__pyx_codeobj__28;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__32;
static PyObject *__pyx_codeobj__50;
static PyObject *__pyx_codeobj__56;
static PyObject *__pyx_codeobj__62;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__84;
static PyObject *__pyx_codeobj__87;
static PyObject *__pyx_codeobj__92;
static PyObject *__pyx_codeobj__116;
static PyObject *__pyx_codeobj__118;
static PyObject *__pyx_codeobj__120;
static PyObject *__pyx_codeobj__122;
static PyObject *__pyx_codeobj__125;
static PyObject *__pyx_codeobj__128;
static PyObject *__pyx_codeobj__130;
static PyObject *__pyx_codeobj__132;
static PyObject *__pyx_codeobj__134;
static PyObject *__pyx_codeobj__137;
static PyObject *__pyx_codeobj__139;
static PyObject *__pyx_codeobj__141;
static PyObject *__pyx_codeobj__143;
static PyObject *__pyx_codeobj__146;
static PyObject *__pyx_codeobj__148;
static PyObject *__pyx_codeobj__150;
static PyObject *__pyx_codeobj__152;
static PyObject *__pyx_codeobj__154;
static PyObject *__pyx_codeobj__156;
static PyObject *__pyx_codeobj__158;
static PyObject *__pyx_codeobj__160;
static PyObject *__pyx_codeobj__163;
static PyObject *__pyx_codeobj__165;
static PyObject *__pyx_codeobj__167;
static PyObject *__pyx_codeobj__169;
static PyObject *__pyx_codeobj__171;
static PyObject *__pyx_codeobj__173;
static PyObject *__pyx_codeobj__175;
static PyObject *__pyx_codeobj__177;
static PyObject *__pyx_codeobj__179;
static PyObject *__pyx_codeobj__181;
static PyObject *__pyx_codeobj__183;
static PyObject *__pyx_codeobj__185;
static PyObject *__pyx_codeobj__187;
static PyObject *__pyx_codeobj__189;
static PyObject *__pyx_codeobj__191;
static PyObject *__pyx_codeobj__194;
static PyObject *__pyx_codeobj__196;
static PyObject *__pyx_codeobj__198;
static PyObject *__pyx_codeobj__200;
static PyObject *__pyx_codeobj__202;
static PyObject *__pyx_codeobj__204;
static PyObject *__pyx_codeobj__206;
static PyObject *__pyx_codeobj__208;
static PyObject *__pyx_codeobj__210;
static PyObject *__pyx_codeobj__213;
static PyObject *__pyx_codeobj__215;
static PyObject *__pyx_codeobj__217;
static PyObject *__pyx_codeobj__219;
static PyObject *__pyx_codeobj__221;
static PyObject *__pyx_codeobj__223;
static PyObject *__pyx_codeobj__226;
static PyObject *__pyx_codeobj__228;
static PyObject *__pyx_codeobj__230;
static PyObject *__pyx_codeobj__232;
static PyObject *__pyx_codeobj__234;
static PyObject *__pyx_codeobj__236;
static PyObject *__pyx_codeobj__239;
static PyObject *__pyx_codeobj__241;
static PyObject *__pyx_codeobj__244;
static PyObject *__pyx_codeobj__246;
static PyObject *__pyx_codeobj__248;
static PyObject *__pyx_codeobj__250;
static PyObject *__pyx_codeobj__253;
static PyObject *__pyx_codeobj__255;
static PyObject *__pyx_codeobj__257;
static PyObject *__pyx_codeobj__259;
static PyObject *__pyx_codeobj__262;
static PyObject *__pyx_codeobj__264;
static PyObject *__pyx_codeobj__266;
static PyObject *__pyx_codeobj__268;
static PyObject *__pyx_codeobj__270;
static PyObject *__pyx_codeobj__272;
static PyObject *__pyx_codeobj__274;
static PyObject *__pyx_codeobj__276;
static PyObject *__pyx_codeobj__278;
static PyObject *__pyx_codeobj__281;
static PyObject *__pyx_codeobj__283;
static PyObject *__pyx_codeobj__285;
static PyObject *__pyx_codeobj__287;
static PyObject *__pyx_codeobj__289;
static PyObject *__pyx_codeobj__291;
static PyObject *__pyx_codeobj__293;
static PyObject *__pyx_codeobj__295;
static PyObject *__pyx_codeobj__297;
static PyObject *__pyx_codeobj__299;
static PyObject *__pyx_codeobj__301;
static PyObject *__pyx_codeobj__303;
static PyObject *__pyx_codeobj__305;
static PyObject *__pyx_codeobj__307;
static PyObject *__pyx_codeobj__309;
static PyObject *__pyx_codeobj__311;
static PyObject *__pyx_codeobj__313;
static PyObject *__pyx_codeobj__316;
static PyObject *__pyx_codeobj__318;
static PyObject *__pyx_codeobj__320;
static PyObject *__pyx_codeobj__322;
static PyObject *__pyx_codeobj__324;
static PyObject *__pyx_codeobj__326;
static PyObject *__pyx_codeobj__328;
static PyObject *__pyx_codeobj__330;
static PyObject *__pyx_codeobj__332;
static PyObject *__pyx_codeobj__335;
static PyObject *__pyx_codeobj__337;
static PyObject *__pyx_codeobj__339;
static PyObject *__pyx_codeobj__342;
static PyObject *__pyx_codeobj__344;
static PyObject *__pyx_codeobj__346;
static PyObject *__pyx_codeobj__348;
static PyObject *__pyx_codeobj__350;
static PyObject *__pyx_codeobj__352;
static PyObject *__pyx_codeobj__354;
static PyObject *__pyx_codeobj__356;
static PyObject *__pyx_codeobj__358;
static PyObject *__pyx_codeobj__360;
static PyObject *__pyx_codeobj__362;
static PyObject *__pyx_codeobj__364;
static PyObject *__pyx_codeobj__366;
static PyObject *__pyx_codeobj__368;
static PyObject *__pyx_codeobj__371;
static PyObject *__pyx_codeobj__373;
static PyObject *__pyx_codeobj__376;
static PyObject *__pyx_codeobj__378;
static PyObject *__pyx_codeobj__380;
static PyObject *__pyx_codeobj__382;
static PyObject *__pyx_codeobj__384;
static PyObject *__pyx_codeobj__386;
static PyObject *__pyx_codeobj__388;
static PyObject *__pyx_codeobj__390;
static PyObject *__pyx_codeobj__392;
static PyObject *__pyx_codeobj__394;
static PyObject *__pyx_codeobj__396;
static PyObject *__pyx_codeobj__399;
static PyObject *__pyx_codeobj__401;
static PyObject *__pyx_codeobj__404;
static PyObject *__pyx_codeobj__407;
static PyObject *__pyx_codeobj__409;
static PyObject *__pyx_codeobj__412;
static PyObject *__pyx_codeobj__414;
static PyObject *__pyx_codeobj__416;
static PyObject *__pyx_codeobj__419;
static PyObject *__pyx_codeobj__421;
static PyObject *__pyx_codeobj__423;
static PyObject *__pyx_codeobj__425;
static PyObject *__pyx_codeobj__427;
static PyObject *__pyx_codeobj__429;
static PyObject *__pyx_codeobj__431;
static PyObject *__pyx_codeobj__433;
static PyObject *__pyx_codeobj__435;
static PyObject *__pyx_codeobj__437;
static PyObject *__pyx_codeobj__439;
static PyObject *__pyx_codeobj__442;
static PyObject *__pyx_codeobj__444;
static PyObject *__pyx_codeobj__446;
static PyObject *__pyx_codeobj__449;
static PyObject *__pyx_codeobj__452;
static PyObject *__pyx_codeobj__455;
static PyObject *__pyx_codeobj__458;
static PyObject *__pyx_codeobj__460;
static PyObject *__pyx_codeobj__463;
static PyObject *__pyx_codeobj__465;
static PyObject *__pyx_codeobj__467;
static PyObject *__pyx_codeobj__469;
static PyObject *__pyx_codeobj__471;
static PyObject *__pyx_codeobj__473;
static PyObject *__pyx_codeobj__475;
static PyObject *__pyx_codeobj__477;
static PyObject *__pyx_codeobj__479;
static PyObject *__pyx_codeobj__481;
static PyObject *__pyx_codeobj__483;
static PyObject *__pyx_codeobj__486;
static PyObject *__pyx_codeobj__488;
static PyObject *__pyx_codeobj__490;
static PyObject *__pyx_codeobj__492;
static PyObject *__pyx_codeobj__494;
static PyObject *__pyx_codeobj__496;
static PyObject *__pyx_codeobj__498;
static PyObject *__pyx_codeobj__500;
static PyObject *__pyx_codeobj__502;
static PyObject *__pyx_codeobj__504;
static PyObject *__pyx_codeobj__522;
static PyObject *__pyx_codeobj__525;
static PyObject *__pyx_codeobj__527;
static PyObject *__pyx_codeobj__529;
static PyObject *__pyx_codeobj__531;
static PyObject *__pyx_codeobj__534;
static PyObject *__pyx_codeobj__536;
static PyObject *__pyx_codeobj__538;
static PyObject *__pyx_codeobj__540;
static PyObject *__pyx_codeobj__542;
static PyObject *__pyx_codeobj__544;
static PyObject *__pyx_codeobj__546;
static PyObject *__pyx_codeobj__548;
static PyObject *__pyx_codeobj__550;
static PyObject *__pyx_codeobj__552;
static PyObject *__pyx_codeobj__554;
static PyObject *__pyx_codeobj__556;
static PyObject *__pyx_codeobj__560;
static PyObject *__pyx_codeobj__562;
static PyObject *__pyx_codeobj__564;
static PyObject *__pyx_codeobj__566;
static PyObject *__pyx_codeobj__569;
static PyObject *__pyx_codeobj__571;
static PyObject *__pyx_codeobj__573;
static PyObject *__pyx_codeobj__575;
static PyObject *__pyx_codeobj__577;
static PyObject *__pyx_codeobj__579;
static PyObject *__pyx_codeobj__583;
static PyObject *__pyx_codeobj__586;
static PyObject *__pyx_codeobj__588;
static PyObject *__pyx_codeobj__590;
static PyObject *__pyx_codeobj__592;
static PyObject *__pyx_codeobj__594;
static PyObject *__pyx_codeobj__597;
static PyObject *__pyx_codeobj__599;
static PyObject *__pyx_codeobj__601;
static PyObject *__pyx_codeobj__603;
static PyObject *__pyx_codeobj__605;
static PyObject *__pyx_codeobj__607;
static PyObject *__pyx_codeobj__609;
static PyObject *__pyx_codeobj__612;
static PyObject *__pyx_codeobj__614;
static PyObject *__pyx_codeobj__616;
static PyObject *__pyx_codeobj__618;
static PyObject *__pyx_codeobj__620;
static PyObject *__pyx_codeobj__622;
static PyObject *__pyx_codeobj__625;
static PyObject *__pyx_codeobj__628;
static PyObject *__pyx_codeobj__630;
static PyObject *__pyx_codeobj__632;
static PyObject *__pyx_codeobj__634;
static PyObject *__pyx_codeobj__636;
static PyObject *__pyx_codeobj__638;
static PyObject *__pyx_codeobj__641;
static PyObject *__pyx_codeobj__643;
static PyObject *__pyx_codeobj__645;
static PyObject *__pyx_codeobj__647;
static PyObject *__pyx_codeobj__649;
static PyObject *__pyx_codeobj__651;
static PyObject *__pyx_codeobj__653;
static PyObject *__pyx_codeobj__655;
static PyObject *__pyx_codeobj__657;
static PyObject *__pyx_codeobj__659;
static PyObject *__pyx_codeobj__662;
static PyObject *__pyx_codeobj__664;
static PyObject *__pyx_codeobj__666;
static PyObject *__pyx_codeobj__668;
static PyObject *__pyx_codeobj__671;
static PyObject *__pyx_codeobj__673;
static PyObject *__pyx_codeobj__675;
static PyObject *__pyx_codeobj__677;
static PyObject *__pyx_codeobj__679;
static PyObject *__pyx_codeobj__681;
static PyObject *__pyx_codeobj__683;
static PyObject *__pyx_codeobj__685;
static PyObject *__pyx_codeobj__687;
static PyObject *__pyx_codeobj__689;
static PyObject *__pyx_codeobj__691;
static PyObject *__pyx_codeobj__694;
static PyObject *__pyx_codeobj__696;
static PyObject *__pyx_codeobj__698;
static PyObject *__pyx_codeobj__700;
static PyObject *__pyx_codeobj__702;
static PyObject *__pyx_codeobj__704;
static PyObject *__pyx_codeobj__706;
static PyObject *__pyx_codeobj__708;
static PyObject *__pyx_codeobj__710;
static PyObject *__pyx_codeobj__712;
static PyObject *__pyx_codeobj__714;
static PyObject *__pyx_codeobj__716;
static PyObject *__pyx_codeobj__718;
static PyObject *__pyx_codeobj__720;
static PyObject *__pyx_codeobj__722;
static PyObject *__pyx_codeobj__724;
static PyObject *__pyx_codeobj__727;
static PyObject *__pyx_codeobj__729;
static PyObject *__pyx_codeobj__731;
static PyObject *__pyx_codeobj__734;
static PyObject *__pyx_codeobj__736;
static PyObject *__pyx_codeobj__739;
static PyObject *__pyx_codeobj__741;
static PyObject *__pyx_codeobj__743;
static PyObject *__pyx_codeobj__745;
static PyObject *__pyx_codeobj__747;
static PyObject *__pyx_codeobj__749;
static PyObject *__pyx_codeobj__751;
static PyObject *__pyx_codeobj__753;
static PyObject *__pyx_codeobj__755;
static PyObject *__pyx_codeobj__757;
static PyObject *__pyx_codeobj__774;
static PyObject *__pyx_codeobj__777;
static PyObject *__pyx_codeobj__779;
static PyObject *__pyx_codeobj__781;
static PyObject *__pyx_codeobj__784;
static PyObject *__pyx_codeobj__787;
static PyObject *__pyx_codeobj__790;
static PyObject *__pyx_codeobj__792;
static PyObject *__pyx_codeobj__794;
static PyObject *__pyx_codeobj__796;
static PyObject *__pyx_codeobj__799;
static PyObject *__pyx_codeobj__801;
static PyObject *__pyx_codeobj__803;
static PyObject *__pyx_codeobj__805;
static PyObject *__pyx_codeobj__807;
static PyObject *__pyx_codeobj__809;
static PyObject *__pyx_codeobj__811;
static PyObject *__pyx_codeobj__813;
static PyObject *__pyx_codeobj__815;
static PyObject *__pyx_codeobj__817;
static PyObject *__pyx_codeobj__819;
static PyObject *__pyx_codeobj__821;
static PyObject *__pyx_codeobj__823;
static PyObject *__pyx_codeobj__825;
static PyObject *__pyx_codeobj__827;
static PyObject *__pyx_codeobj__829;
static PyObject *__pyx_codeobj__832;
static PyObject *__pyx_codeobj__834;
static PyObject *__pyx_codeobj__836;
static PyObject *__pyx_codeobj__838;
static PyObject *__pyx_codeobj__840;
static PyObject *__pyx_codeobj__842;
static PyObject *__pyx_codeobj__844;
static PyObject *__pyx_codeobj__846;
static PyObject *__pyx_codeobj__848;
static PyObject *__pyx_codeobj__851;
static PyObject *__pyx_codeobj__854;
static PyObject *__pyx_codeobj__856;
static PyObject *__pyx_codeobj__859;
static PyObject *__pyx_codeobj__861;
static PyObject *__pyx_codeobj__863;
static PyObject *__pyx_codeobj__865;
static PyObject *__pyx_codeobj__867;
static PyObject *__pyx_codeobj__869;
static PyObject *__pyx_codeobj__871;
static PyObject *__pyx_codeobj__873;
static PyObject *__pyx_codeobj__875;
static PyObject *__pyx_codeobj__877;
static PyObject *__pyx_codeobj__879;
static PyObject *__pyx_codeobj__881;
static PyObject *__pyx_codeobj__884;
static PyObject *__pyx_codeobj__886;
/* Late includes */

/* "mathics/core/expression.py":25
 * 
 * 
 * def fully_qualified_symbol_name(name) -> bool:             # <<<<<<<<<<<<<<
 *     return (
 *         isinstance(name, str)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_1fully_qualified_symbol_name(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_1fully_qualified_symbol_name = {"fully_qualified_symbol_name", (PyCFunction)__pyx_pw_7mathics_4core_10expression_1fully_qualified_symbol_name, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_1fully_qualified_symbol_name(PyObject *__pyx_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fully_qualified_symbol_name (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_fully_qualified_symbol_name(__pyx_self, ((PyObject *)__pyx_v_name));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_fully_qualified_symbol_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fully_qualified_symbol_name", 0);

  /* "mathics/core/expression.py":26
 * 
 * def fully_qualified_symbol_name(name) -> bool:
 *     return (             # <<<<<<<<<<<<<<
 *         isinstance(name, str)
 *         and "`" in name
 */
  __Pyx_XDECREF(__pyx_r);

  /* "mathics/core/expression.py":27
 * def fully_qualified_symbol_name(name) -> bool:
 *     return (
 *         isinstance(name, str)             # <<<<<<<<<<<<<<
 *         and "`" in name
 *         and not name.startswith("`")
 */
  __pyx_t_2 = PyUnicode_Check(__pyx_v_name); 
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":28
 *     return (
 *         isinstance(name, str)
 *         and "`" in name             # <<<<<<<<<<<<<<
 *         and not name.startswith("`")
 *         and not name.endswith("`")
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_, __pyx_v_name, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 28, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":29
 *         isinstance(name, str)
 *         and "`" in name
 *         and not name.startswith("`")             # <<<<<<<<<<<<<<
 *         and not name.endswith("`")
 *         and "``" not in name
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_startswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __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_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = (!__pyx_t_2);
  if (__pyx_t_6) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":30
 *         and "`" in name
 *         and not name.startswith("`")
 *         and not name.endswith("`")             # <<<<<<<<<<<<<<
 *         and "``" not in name
 *     )
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_endswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __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_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = (!__pyx_t_6);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":31
 *         and not name.startswith("`")
 *         and not name.endswith("`")
 *         and "``" not in name             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__2, __pyx_v_name, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 31, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":25
 * 
 * 
 * def fully_qualified_symbol_name(name) -> bool:             # <<<<<<<<<<<<<<
 *     return (
 *         isinstance(name, str)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.fully_qualified_symbol_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":35
 * 
 * 
 * def valid_context_name(ctx, allow_initial_backquote=False) -> bool:             # <<<<<<<<<<<<<<
 *     return (
 *         isinstance(ctx, str)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_3valid_context_name(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_3valid_context_name = {"valid_context_name", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_3valid_context_name, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_3valid_context_name(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ctx = 0;
  PyObject *__pyx_v_allow_initial_backquote = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("valid_context_name (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ctx,&__pyx_n_s_allow_initial_backquote,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ctx)) != 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_allow_initial_backquote);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "valid_context_name") < 0)) __PYX_ERR(0, 35, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ctx = values[0];
    __pyx_v_allow_initial_backquote = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("valid_context_name", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 35, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.valid_context_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_2valid_context_name(__pyx_self, __pyx_v_ctx, __pyx_v_allow_initial_backquote);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_2valid_context_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ctx, PyObject *__pyx_v_allow_initial_backquote) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("valid_context_name", 0);

  /* "mathics/core/expression.py":36
 * 
 * def valid_context_name(ctx, allow_initial_backquote=False) -> bool:
 *     return (             # <<<<<<<<<<<<<<
 *         isinstance(ctx, str)
 *         and ctx.endswith("`")
 */
  __Pyx_XDECREF(__pyx_r);

  /* "mathics/core/expression.py":37
 * def valid_context_name(ctx, allow_initial_backquote=False) -> bool:
 *     return (
 *         isinstance(ctx, str)             # <<<<<<<<<<<<<<
 *         and ctx.endswith("`")
 *         and "``" not in ctx
 */
  __pyx_t_2 = PyUnicode_Check(__pyx_v_ctx); 
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":38
 *     return (
 *         isinstance(ctx, str)
 *         and ctx.endswith("`")             # <<<<<<<<<<<<<<
 *         and "``" not in ctx
 *         and (allow_initial_backquote or not ctx.startswith("`"))
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ctx, __pyx_n_s_endswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __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_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 38, __pyx_L1_error)
  if (__pyx_t_2) {
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":39
 *         isinstance(ctx, str)
 *         and ctx.endswith("`")
 *         and "``" not in ctx             # <<<<<<<<<<<<<<
 *         and (allow_initial_backquote or not ctx.startswith("`"))
 *     )
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__2, __pyx_v_ctx, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 39, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":40
 *         and ctx.endswith("`")
 *         and "``" not in ctx
 *         and (allow_initial_backquote or not ctx.startswith("`"))             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_allow_initial_backquote); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 40, __pyx_L1_error)
  if (!__pyx_t_2) {
  } else {
    __Pyx_INCREF(__pyx_v_allow_initial_backquote);
    __pyx_t_1 = __pyx_v_allow_initial_backquote;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_ctx, __pyx_n_s_startswith); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __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_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = (!__pyx_t_2);
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":35
 * 
 * 
 * def valid_context_name(ctx, allow_initial_backquote=False) -> bool:             # <<<<<<<<<<<<<<
 *     return (
 *         isinstance(ctx, str)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.valid_context_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":44
 * 
 * 
 * def ensure_context(name, context="System`") -> str:             # <<<<<<<<<<<<<<
 *     assert isinstance(name, str)
 *     assert name != ""
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_5ensure_context(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_5ensure_context = {"ensure_context", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_5ensure_context, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_5ensure_context(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_context = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ensure_context (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_context,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject*)__pyx_kp_u_System));
    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_name)) != 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_context);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ensure_context") < 0)) __PYX_ERR(0, 44, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_context = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ensure_context", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 44, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ensure_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4ensure_context(__pyx_self, __pyx_v_name, __pyx_v_context);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4ensure_context(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name, PyObject *__pyx_v_context) {
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_context", 0);

  /* "mathics/core/expression.py":45
 * 
 * def ensure_context(name, context="System`") -> str:
 *     assert isinstance(name, str)             # <<<<<<<<<<<<<<
 *     assert name != ""
 *     if "`" in name:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = PyUnicode_Check(__pyx_v_name); 
    if (unlikely(!(__pyx_t_1 != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 45, __pyx_L1_error)
    }
  }
  #endif

  /* "mathics/core/expression.py":46
 * def ensure_context(name, context="System`") -> str:
 *     assert isinstance(name, str)
 *     assert name != ""             # <<<<<<<<<<<<<<
 *     if "`" in name:
 *         # Symbol has a context mark -> it came from the parser
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u__3, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 46, __pyx_L1_error)
    if (unlikely(!__pyx_t_1)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 46, __pyx_L1_error)
    }
  }
  #endif

  /* "mathics/core/expression.py":47
 *     assert isinstance(name, str)
 *     assert name != ""
 *     if "`" in name:             # <<<<<<<<<<<<<<
 *         # Symbol has a context mark -> it came from the parser
 *         assert fully_qualified_symbol_name(name)
 */
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_, __pyx_v_name, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 47, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":49
 *     if "`" in name:
 *         # Symbol has a context mark -> it came from the parser
 *         assert fully_qualified_symbol_name(name)             # <<<<<<<<<<<<<<
 *         return name
 *     # Symbol came from Python code doing something like
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_fully_qualified_symbol_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_name);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 49, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(0, 49, __pyx_L1_error)
      }
    }
    #endif

    /* "mathics/core/expression.py":50
 *         # Symbol has a context mark -> it came from the parser
 *         assert fully_qualified_symbol_name(name)
 *         return name             # <<<<<<<<<<<<<<
 *     # Symbol came from Python code doing something like
 *     # Expression('Plus', ...) -> use System` or more generally
 */
    __Pyx_XDECREF(__pyx_r);
    if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(0, 50, __pyx_L1_error)
    __Pyx_INCREF(__pyx_v_name);
    __pyx_r = ((PyObject*)__pyx_v_name);
    goto __pyx_L0;

    /* "mathics/core/expression.py":47
 *     assert isinstance(name, str)
 *     assert name != ""
 *     if "`" in name:             # <<<<<<<<<<<<<<
 *         # Symbol has a context mark -> it came from the parser
 *         assert fully_qualified_symbol_name(name)
 */
  }

  /* "mathics/core/expression.py":54
 *     # Expression('Plus', ...) -> use System` or more generally
 *     # context + name
 *     return context + name             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyNumber_Add(__pyx_v_context, __pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 54, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":44
 * 
 * 
 * def ensure_context(name, context="System`") -> str:             # <<<<<<<<<<<<<<
 *     assert isinstance(name, str)
 *     assert name != ""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.ensure_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":57
 * 
 * 
 * def strip_context(name) -> str:             # <<<<<<<<<<<<<<
 *     if "`" in name:
 *         return name[name.rindex("`") + 1 :]
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7strip_context(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7strip_context = {"strip_context", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7strip_context, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7strip_context(PyObject *__pyx_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("strip_context (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6strip_context(__pyx_self, ((PyObject *)__pyx_v_name));

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

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

  /* "mathics/core/expression.py":58
 * 
 * def strip_context(name) -> str:
 *     if "`" in name:             # <<<<<<<<<<<<<<
 *         return name[name.rindex("`") + 1 :]
 *     return name
 */
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_, __pyx_v_name, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 58, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":59
 * def strip_context(name) -> str:
 *     if "`" in name:
 *         return name[name.rindex("`") + 1 :]             # <<<<<<<<<<<<<<
 *     return name
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_name, __pyx_n_s_rindex); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __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_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_name, 0, 0, &__pyx_t_4, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 59, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":58
 * 
 * def strip_context(name) -> str:
 *     if "`" in name:             # <<<<<<<<<<<<<<
 *         return name[name.rindex("`") + 1 :]
 *     return name
 */
  }

  /* "mathics/core/expression.py":60
 *     if "`" in name:
 *         return name[name.rindex("`") + 1 :]
 *     return name             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_INCREF(__pyx_v_name);
  __pyx_r = ((PyObject*)__pyx_v_name);
  goto __pyx_L0;

  /* "mathics/core/expression.py":57
 * 
 * 
 * def strip_context(name) -> str:             # <<<<<<<<<<<<<<
 *     if "`" in name:
 *         return name[name.rindex("`") + 1 :]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.strip_context", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":64
 * 
 * # system_symbols('A', 'B', ...) -> ['System`A', 'System`B', ...]
 * def system_symbols(*symbols) -> typing.List[str]:             # <<<<<<<<<<<<<<
 *     return [ensure_context(s) for s in symbols]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_9system_symbols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_9system_symbols = {"system_symbols", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_9system_symbols, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_9system_symbols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_symbols = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("system_symbols (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "system_symbols", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_symbols = __pyx_args;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8system_symbols(__pyx_self, __pyx_v_symbols);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8system_symbols(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_symbols) {
  PyObject *__pyx_7genexpr__pyx_v_s = 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 = 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("system_symbols", 0);

  /* "mathics/core/expression.py":65
 * # system_symbols('A', 'B', ...) -> ['System`A', 'System`B', ...]
 * def system_symbols(*symbols) -> typing.List[str]:
 *     return [ensure_context(s) for s in symbols]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_v_symbols; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 65, __pyx_L5_error)
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_s, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ensure_context); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_7genexpr__pyx_v_s) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_7genexpr__pyx_v_s);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 65, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_s); __pyx_7genexpr__pyx_v_s = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_s); __pyx_7genexpr__pyx_v_s = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":64
 * 
 * # system_symbols('A', 'B', ...) -> ['System`A', 'System`B', ...]
 * def system_symbols(*symbols) -> typing.List[str]:             # <<<<<<<<<<<<<<
 *     return [ensure_context(s) for s in symbols]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.system_symbols", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":69
 * 
 * # system_symbols_dict({'SomeSymbol': ...}) -> {'System`SomeSymbol': ...}
 * def system_symbols_dict(d):             # <<<<<<<<<<<<<<
 *     return {ensure_context(k): v for k, v in d.items()}
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11system_symbols_dict(PyObject *__pyx_self, PyObject *__pyx_v_d); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11system_symbols_dict = {"system_symbols_dict", (PyCFunction)__pyx_pw_7mathics_4core_10expression_11system_symbols_dict, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11system_symbols_dict(PyObject *__pyx_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("system_symbols_dict (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10system_symbols_dict(__pyx_self, ((PyObject *)__pyx_v_d));

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

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

  /* "mathics/core/expression.py":70
 * # system_symbols_dict({'SomeSymbol': ...}) -> {'System`SomeSymbol': ...}
 * def system_symbols_dict(d):
 *     return {ensure_context(k): v for k, v in d.items()}             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = 0;
    if (unlikely(__pyx_v_d == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
      __PYX_ERR(0, 70, __pyx_L5_error)
    }
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_d, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
      if (unlikely(__pyx_t_8 == 0)) break;
      if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 70, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_k, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_v, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ensure_context); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_8genexpr1__pyx_v_k) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_8genexpr1__pyx_v_k);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 70, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_t_7, (PyObject*)__pyx_8genexpr1__pyx_v_v))) __PYX_ERR(0, 70, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k); __pyx_8genexpr1__pyx_v_k = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __pyx_8genexpr1__pyx_v_v = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k); __pyx_8genexpr1__pyx_v_k = 0;
    __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __pyx_8genexpr1__pyx_v_v = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":69
 * 
 * # system_symbols_dict({'SomeSymbol': ...}) -> {'System`SomeSymbol': ...}
 * def system_symbols_dict(d):             # <<<<<<<<<<<<<<
 *     return {ensure_context(k): v for k, v in d.items()}
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.core.expression.system_symbols_dict", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_k);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":74
 * 
 * class BoxError(Exception):
 *     def __init__(self, box, form) -> None:             # <<<<<<<<<<<<<<
 *         super().__init__("Box %s cannot be formatted as %s" % (box, form))
 *         self.box = box
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8BoxError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8BoxError_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8BoxError_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8BoxError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_box = 0;
  PyObject *__pyx_v_form = 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_box,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_box)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 74, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 74, __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, 74, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_box = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 74, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BoxError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8BoxError___init__(__pyx_self, __pyx_v_self, __pyx_v_box, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8BoxError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_box, PyObject *__pyx_v_form) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_UCS4 __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "mathics/core/expression.py":75
 * class BoxError(Exception):
 *     def __init__(self, box, form) -> None:
 *         super().__init__("Box %s cannot be formatted as %s" % (box, form))             # <<<<<<<<<<<<<<
 *         self.box = box
 *         self.form = form
 */
  __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 75, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = 0;
  __pyx_t_5 = 127;
  __Pyx_INCREF(__pyx_kp_u_Box);
  __pyx_t_4 += 4;
  __Pyx_GIVEREF(__pyx_kp_u_Box);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Box);
  __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_box), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
  __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_kp_u_cannot_be_formatted_as);
  __pyx_t_4 += 24;
  __Pyx_GIVEREF(__pyx_kp_u_cannot_be_formatted_as);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_cannot_be_formatted_as);
  __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_form), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5;
  __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":76
 *     def __init__(self, box, form) -> None:
 *         super().__init__("Box %s cannot be formatted as %s" % (box, form))
 *         self.box = box             # <<<<<<<<<<<<<<
 *         self.form = form
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_box, __pyx_v_box) < 0) __PYX_ERR(0, 76, __pyx_L1_error)

  /* "mathics/core/expression.py":77
 *         super().__init__("Box %s cannot be formatted as %s" % (box, form))
 *         self.box = box
 *         self.form = form             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_form, __pyx_v_form) < 0) __PYX_ERR(0, 77, __pyx_L1_error)

  /* "mathics/core/expression.py":74
 * 
 * class BoxError(Exception):
 *     def __init__(self, box, form) -> None:             # <<<<<<<<<<<<<<
 *         super().__init__("Box %s cannot be formatted as %s" % (box, form))
 *         self.box = box
 */

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

/* "mathics/core/expression.py":81
 * 
 * class ExpressionPointer(object):
 *     def __init__(self, parent, position) -> None:             # <<<<<<<<<<<<<<
 *         self.parent = parent
 *         self.position = position
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_17ExpressionPointer_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_17ExpressionPointer_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_17ExpressionPointer_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_17ExpressionPointer_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_parent = 0;
  PyObject *__pyx_v_position = 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_parent,&__pyx_n_s_position,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parent)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 81, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_position)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 81, __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, 81, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_parent = values[1];
    __pyx_v_position = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 81, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ExpressionPointer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_17ExpressionPointer___init__(__pyx_self, __pyx_v_self, __pyx_v_parent, __pyx_v_position);

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

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

  /* "mathics/core/expression.py":82
 * class ExpressionPointer(object):
 *     def __init__(self, parent, position) -> None:
 *         self.parent = parent             # <<<<<<<<<<<<<<
 *         self.position = position
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_parent, __pyx_v_parent) < 0) __PYX_ERR(0, 82, __pyx_L1_error)

  /* "mathics/core/expression.py":83
 *     def __init__(self, parent, position) -> None:
 *         self.parent = parent
 *         self.position = position             # <<<<<<<<<<<<<<
 * 
 *     def replace(self, new) -> None:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_position, __pyx_v_position) < 0) __PYX_ERR(0, 83, __pyx_L1_error)

  /* "mathics/core/expression.py":81
 * 
 * class ExpressionPointer(object):
 *     def __init__(self, parent, position) -> None:             # <<<<<<<<<<<<<<
 *         self.parent = parent
 *         self.position = position
 */

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

/* "mathics/core/expression.py":85
 *         self.position = position
 * 
 *     def replace(self, new) -> None:             # <<<<<<<<<<<<<<
 *         if self.position == 0:
 *             self.parent.set_head(new)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_17ExpressionPointer_3replace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_17ExpressionPointer_3replace = {"replace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_17ExpressionPointer_3replace, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_17ExpressionPointer_3replace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_new = 0;
  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_self,&__pyx_n_s_new,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_new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, 1); __PYX_ERR(0, 85, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace") < 0)) __PYX_ERR(0, 85, __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_new = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 85, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ExpressionPointer.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_17ExpressionPointer_2replace(__pyx_self, __pyx_v_self, __pyx_v_new);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_17ExpressionPointer_2replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_new) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace", 0);

  /* "mathics/core/expression.py":86
 * 
 *     def replace(self, new) -> None:
 *         if self.position == 0:             # <<<<<<<<<<<<<<
 *             self.parent.set_head(new)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_position); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":87
 *     def replace(self, new) -> None:
 *         if self.position == 0:
 *             self.parent.set_head(new)             # <<<<<<<<<<<<<<
 *         else:
 *             self.parent.set_leaf(self.position - 1, new)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_parent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_set_head); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_v_new) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_new);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mathics/core/expression.py":86
 * 
 *     def replace(self, new) -> None:
 *         if self.position == 0:             # <<<<<<<<<<<<<<
 *             self.parent.set_head(new)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":89
 *             self.parent.set_head(new)
 *         else:
 *             self.parent.set_leaf(self.position - 1, new)             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self) -> str:
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_parent); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_set_leaf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_position); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    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_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_v_new};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_v_new};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_5);
      __Pyx_INCREF(__pyx_v_new);
      __Pyx_GIVEREF(__pyx_v_new);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_new);
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":85
 *         self.position = position
 * 
 *     def replace(self, new) -> None:             # <<<<<<<<<<<<<<
 *         if self.position == 0:
 *             self.parent.set_head(new)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.ExpressionPointer.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":91
 *             self.parent.set_leaf(self.position - 1, new)
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[[%s]]" % (self.parent, self.position)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_17ExpressionPointer_5__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_17ExpressionPointer_5__str__ = {"__str__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_17ExpressionPointer_5__str__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_17ExpressionPointer_5__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_17ExpressionPointer_4__str__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_17ExpressionPointer_4__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__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("__str__", 0);

  /* "mathics/core/expression.py":92
 * 
 *     def __str__(self) -> str:
 *         return "%s[[%s]]" % (self.parent, self.position)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_parent); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __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, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__4);
  __pyx_t_2 += 2;
  __Pyx_GIVEREF(__pyx_kp_u__4);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_position); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __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, 2, __pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_kp_u__5);
  __pyx_t_2 += 2;
  __Pyx_GIVEREF(__pyx_kp_u__5);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__5);
  __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":91
 *             self.parent.set_leaf(self.position - 1, new)
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[[%s]]" % (self.parent, self.position)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.ExpressionPointer.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":95
 * 
 * 
 * def from_python(arg):             # <<<<<<<<<<<<<<
 *     """Converts a Python expression into a Mathics expression.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13from_python(PyObject *__pyx_self, PyObject *__pyx_v_arg); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_12from_python[] = "Converts a Python expression into a Mathics expression.\n\n    TODO: I think there are number of subtleties to be explained here.\n    In particular, the expression might beeen the result of evaluation\n    a sympy expression which contains sympy symbols.\n\n    If the end result is to go back into Mathics for further\n    evaluation, then probably no problem.  However if the end result\n    is produce say a Python string, then at a minimum we may want to\n    convert backtick (context) symbols into some Python identifier\n    symbol like underscore.\n    ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13from_python = {"from_python", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13from_python, METH_O, __pyx_doc_7mathics_4core_10expression_12from_python};
static PyObject *__pyx_pw_7mathics_4core_10expression_13from_python(PyObject *__pyx_self, PyObject *__pyx_v_arg) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_python (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_12from_python(__pyx_self, ((PyObject *)__pyx_v_arg));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_12from_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arg) {
  PyObject *__pyx_v_BoxConstruct = NULL;
  PyObject *__pyx_v_number_type = NULL;
  PyObject *__pyx_v_entries = NULL;
  PyObject *__pyx_8genexpr2__pyx_v_key = NULL;
  PyObject *__pyx_8genexpr3__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_python", 0);

  /* "mathics/core/expression.py":108
 *     symbol like underscore.
 *     """
 *     from mathics.builtin.base import BoxConstruct             # <<<<<<<<<<<<<<
 * 
 *     number_type = get_type(arg)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_BoxConstruct);
  __Pyx_GIVEREF(__pyx_n_s_BoxConstruct);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_BoxConstruct);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_builtin_base, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __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_BoxConstruct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_BoxConstruct = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":110
 *     from mathics.builtin.base import BoxConstruct
 * 
 *     number_type = get_type(arg)             # <<<<<<<<<<<<<<
 *     if arg is None:
 *         return SymbolNull
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_get_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __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_v_arg) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_arg);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_number_type = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":111
 * 
 *     number_type = get_type(arg)
 *     if arg is None:             # <<<<<<<<<<<<<<
 *         return SymbolNull
 *     if isinstance(arg, bool):
 */
  __pyx_t_4 = (__pyx_v_arg == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":112
 *     number_type = get_type(arg)
 *     if arg is None:
 *         return SymbolNull             # <<<<<<<<<<<<<<
 *     if isinstance(arg, bool):
 *         return SymbolTrue if arg else SymbolFalse
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SymbolNull); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":111
 * 
 *     number_type = get_type(arg)
 *     if arg is None:             # <<<<<<<<<<<<<<
 *         return SymbolNull
 *     if isinstance(arg, bool):
 */
  }

  /* "mathics/core/expression.py":113
 *     if arg is None:
 *         return SymbolNull
 *     if isinstance(arg, bool):             # <<<<<<<<<<<<<<
 *         return SymbolTrue if arg else SymbolFalse
 *     if isinstance(arg, int) or number_type == "z":
 */
  __pyx_t_2 = ((PyObject*)&PyBool_Type);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":114
 *         return SymbolNull
 *     if isinstance(arg, bool):
 *         return SymbolTrue if arg else SymbolFalse             # <<<<<<<<<<<<<<
 *     if isinstance(arg, int) or number_type == "z":
 *         return Integer(arg)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_arg); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 114, __pyx_L1_error)
    if (__pyx_t_4) {
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SymbolTrue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
      __pyx_t_1 = 0;
    } else {
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SymbolFalse); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":113
 *     if arg is None:
 *         return SymbolNull
 *     if isinstance(arg, bool):             # <<<<<<<<<<<<<<
 *         return SymbolTrue if arg else SymbolFalse
 *     if isinstance(arg, int) or number_type == "z":
 */
  }

  /* "mathics/core/expression.py":115
 *     if isinstance(arg, bool):
 *         return SymbolTrue if arg else SymbolFalse
 *     if isinstance(arg, int) or number_type == "z":             # <<<<<<<<<<<<<<
 *         return Integer(arg)
 *     elif isinstance(arg, float) or number_type == "f":
 */
  __pyx_t_5 = PyInt_Check(__pyx_v_arg); 
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_number_type, __pyx_n_u_z, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 115, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_6;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":116
 *         return SymbolTrue if arg else SymbolFalse
 *     if isinstance(arg, int) or number_type == "z":
 *         return Integer(arg)             # <<<<<<<<<<<<<<
 *     elif isinstance(arg, float) or number_type == "f":
 *         return Real(arg)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Integer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __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_v_arg) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_arg);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __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;

    /* "mathics/core/expression.py":115
 *     if isinstance(arg, bool):
 *         return SymbolTrue if arg else SymbolFalse
 *     if isinstance(arg, int) or number_type == "z":             # <<<<<<<<<<<<<<
 *         return Integer(arg)
 *     elif isinstance(arg, float) or number_type == "f":
 */
  }

  /* "mathics/core/expression.py":117
 *     if isinstance(arg, int) or number_type == "z":
 *         return Integer(arg)
 *     elif isinstance(arg, float) or number_type == "f":             # <<<<<<<<<<<<<<
 *         return Real(arg)
 *     elif number_type == "q":
 */
  __pyx_t_6 = PyFloat_Check(__pyx_v_arg); 
  __pyx_t_5 = (__pyx_t_6 != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_number_type, __pyx_n_u_f, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 117, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_5;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":118
 *         return Integer(arg)
 *     elif isinstance(arg, float) or number_type == "f":
 *         return Real(arg)             # <<<<<<<<<<<<<<
 *     elif number_type == "q":
 *         return Rational(arg)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __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_v_arg) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_arg);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __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;

    /* "mathics/core/expression.py":117
 *     if isinstance(arg, int) or number_type == "z":
 *         return Integer(arg)
 *     elif isinstance(arg, float) or number_type == "f":             # <<<<<<<<<<<<<<
 *         return Real(arg)
 *     elif number_type == "q":
 */
  }

  /* "mathics/core/expression.py":119
 *     elif isinstance(arg, float) or number_type == "f":
 *         return Real(arg)
 *     elif number_type == "q":             # <<<<<<<<<<<<<<
 *         return Rational(arg)
 *     elif isinstance(arg, complex):
 */
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_number_type, __pyx_n_u_q, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 119, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":120
 *         return Real(arg)
 *     elif number_type == "q":
 *         return Rational(arg)             # <<<<<<<<<<<<<<
 *     elif isinstance(arg, complex):
 *         return Complex(Real(arg.real), Real(arg.imag))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Rational); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __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_v_arg) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_arg);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __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;

    /* "mathics/core/expression.py":119
 *     elif isinstance(arg, float) or number_type == "f":
 *         return Real(arg)
 *     elif number_type == "q":             # <<<<<<<<<<<<<<
 *         return Rational(arg)
 *     elif isinstance(arg, complex):
 */
  }

  /* "mathics/core/expression.py":121
 *     elif number_type == "q":
 *         return Rational(arg)
 *     elif isinstance(arg, complex):             # <<<<<<<<<<<<<<
 *         return Complex(Real(arg.real), Real(arg.imag))
 *     elif number_type == "c":
 */
  __pyx_t_4 = PyComplex_Check(__pyx_v_arg); 
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":122
 *         return Rational(arg)
 *     elif isinstance(arg, complex):
 *         return Complex(Real(arg.real), Real(arg.imag))             # <<<<<<<<<<<<<<
 *     elif number_type == "c":
 *         return Complex(arg.real, arg.imag)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Complex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Real); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_real); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_3 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Real); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_imag); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_3, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_3, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 122, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_11, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_11, __pyx_t_7);
      __pyx_t_3 = 0;
      __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":121
 *     elif number_type == "q":
 *         return Rational(arg)
 *     elif isinstance(arg, complex):             # <<<<<<<<<<<<<<
 *         return Complex(Real(arg.real), Real(arg.imag))
 *     elif number_type == "c":
 */
  }

  /* "mathics/core/expression.py":123
 *     elif isinstance(arg, complex):
 *         return Complex(Real(arg.real), Real(arg.imag))
 *     elif number_type == "c":             # <<<<<<<<<<<<<<
 *         return Complex(arg.real, arg.imag)
 *     elif isinstance(arg, str):
 */
  __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_number_type, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 123, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":124
 *         return Complex(Real(arg.real), Real(arg.imag))
 *     elif number_type == "c":
 *         return Complex(arg.real, arg.imag)             # <<<<<<<<<<<<<<
 *     elif isinstance(arg, str):
 *         return String(arg)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Complex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_real); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_imag); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = NULL;
    __pyx_t_11 = 0;
    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_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_9, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_9, __pyx_t_7};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_11, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_11, __pyx_t_7);
      __pyx_t_9 = 0;
      __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":123
 *     elif isinstance(arg, complex):
 *         return Complex(Real(arg.real), Real(arg.imag))
 *     elif number_type == "c":             # <<<<<<<<<<<<<<
 *         return Complex(arg.real, arg.imag)
 *     elif isinstance(arg, str):
 */
  }

  /* "mathics/core/expression.py":125
 *     elif number_type == "c":
 *         return Complex(arg.real, arg.imag)
 *     elif isinstance(arg, str):             # <<<<<<<<<<<<<<
 *         return String(arg)
 *         # if arg[0] == arg[-1] == '"':
 */
  __pyx_t_5 = PyUnicode_Check(__pyx_v_arg); 
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":126
 *         return Complex(arg.real, arg.imag)
 *     elif isinstance(arg, str):
 *         return String(arg)             # <<<<<<<<<<<<<<
 *         # if arg[0] == arg[-1] == '"':
 *         #     return String(arg[1:-1])
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_String); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_v_arg) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_arg);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __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;

    /* "mathics/core/expression.py":125
 *     elif number_type == "c":
 *         return Complex(arg.real, arg.imag)
 *     elif isinstance(arg, str):             # <<<<<<<<<<<<<<
 *         return String(arg)
 *         # if arg[0] == arg[-1] == '"':
 */
  }

  /* "mathics/core/expression.py":131
 *         # else:
 *         #     return Symbol(arg)
 *     elif isinstance(arg, dict):             # <<<<<<<<<<<<<<
 *         entries = [
 *             Expression(
 */
  __pyx_t_4 = PyDict_Check(__pyx_v_arg); 
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":132
 *         #     return Symbol(arg)
 *     elif isinstance(arg, dict):
 *         entries = [             # <<<<<<<<<<<<<<
 *             Expression(
 *                 "Rule",
 */
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "mathics/core/expression.py":138
 *                 from_python(arg[key]),
 *             )
 *             for key in arg             # <<<<<<<<<<<<<<
 *         ]
 *         return Expression(SymbolList, *entries)
 */
      if (likely(PyList_CheckExact(__pyx_v_arg)) || PyTuple_CheckExact(__pyx_v_arg)) {
        __pyx_t_1 = __pyx_v_arg; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0;
        __pyx_t_13 = NULL;
      } else {
        __pyx_t_12 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_arg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_13 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 138, __pyx_L12_error)
      }
      for (;;) {
        if (likely(!__pyx_t_13)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_8); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 138, __pyx_L12_error)
            #else
            __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 138, __pyx_L12_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          } else {
            if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_8); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 138, __pyx_L12_error)
            #else
            __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 138, __pyx_L12_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          }
        } else {
          __pyx_t_8 = __pyx_t_13(__pyx_t_1);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 138, __pyx_L12_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_8);
        }
        __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_key, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "mathics/core/expression.py":133
 *     elif isinstance(arg, dict):
 *         entries = [
 *             Expression(             # <<<<<<<<<<<<<<
 *                 "Rule",
 *                 from_python(key),
 */
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Expression); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 133, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "mathics/core/expression.py":135
 *             Expression(
 *                 "Rule",
 *                 from_python(key),             # <<<<<<<<<<<<<<
 *                 from_python(arg[key]),
 *             )
 */
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_from_python); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_10, __pyx_8genexpr2__pyx_v_key) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_8genexpr2__pyx_v_key);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 135, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "mathics/core/expression.py":136
 *                 "Rule",
 *                 from_python(key),
 *                 from_python(arg[key]),             # <<<<<<<<<<<<<<
 *             )
 *             for key in arg
 */
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_from_python); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 136, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_14 = __Pyx_PyObject_GetItem(__pyx_v_arg, __pyx_8genexpr2__pyx_v_key); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 136, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_15 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        __pyx_t_3 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_15, __pyx_t_14) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_14);
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = NULL;
        __pyx_t_11 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_11 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_n_u_Rule, __pyx_t_9, __pyx_t_3};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L12_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_n_u_Rule, __pyx_t_9, __pyx_t_3};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L12_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_14 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 133, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_14);
          if (__pyx_t_10) {
            __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_10); __pyx_t_10 = NULL;
          }
          __Pyx_INCREF(__pyx_n_u_Rule);
          __Pyx_GIVEREF(__pyx_n_u_Rule);
          PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_11, __pyx_n_u_Rule);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_11, __pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_11, __pyx_t_3);
          __pyx_t_9 = 0;
          __pyx_t_3 = 0;
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 132, __pyx_L12_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "mathics/core/expression.py":138
 *                 from_python(arg[key]),
 *             )
 *             for key in arg             # <<<<<<<<<<<<<<
 *         ]
 *         return Expression(SymbolList, *entries)
 */
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_key); __pyx_8genexpr2__pyx_v_key = 0;
      goto __pyx_L15_exit_scope;
      __pyx_L12_error:;
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_key); __pyx_8genexpr2__pyx_v_key = 0;
      goto __pyx_L1_error;
      __pyx_L15_exit_scope:;
    } /* exit inner scope */
    __pyx_v_entries = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":140
 *             for key in arg
 *         ]
 *         return Expression(SymbolList, *entries)             # <<<<<<<<<<<<<<
 *     elif isinstance(arg, BaseExpression):
 *         return arg
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PySequence_Tuple(__pyx_v_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyNumber_Add(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":131
 *         # else:
 *         #     return Symbol(arg)
 *     elif isinstance(arg, dict):             # <<<<<<<<<<<<<<
 *         entries = [
 *             Expression(
 */
  }

  /* "mathics/core/expression.py":141
 *         ]
 *         return Expression(SymbolList, *entries)
 *     elif isinstance(arg, BaseExpression):             # <<<<<<<<<<<<<<
 *         return arg
 *     elif isinstance(arg, BoxConstruct):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BaseExpression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":142
 *         return Expression(SymbolList, *entries)
 *     elif isinstance(arg, BaseExpression):
 *         return arg             # <<<<<<<<<<<<<<
 *     elif isinstance(arg, BoxConstruct):
 *         return arg
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_arg);
    __pyx_r = __pyx_v_arg;
    goto __pyx_L0;

    /* "mathics/core/expression.py":141
 *         ]
 *         return Expression(SymbolList, *entries)
 *     elif isinstance(arg, BaseExpression):             # <<<<<<<<<<<<<<
 *         return arg
 *     elif isinstance(arg, BoxConstruct):
 */
  }

  /* "mathics/core/expression.py":143
 *     elif isinstance(arg, BaseExpression):
 *         return arg
 *     elif isinstance(arg, BoxConstruct):             # <<<<<<<<<<<<<<
 *         return arg
 *     elif isinstance(arg, list) or isinstance(arg, tuple):
 */
  __pyx_t_4 = PyObject_IsInstance(__pyx_v_arg, __pyx_v_BoxConstruct); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 143, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":144
 *         return arg
 *     elif isinstance(arg, BoxConstruct):
 *         return arg             # <<<<<<<<<<<<<<
 *     elif isinstance(arg, list) or isinstance(arg, tuple):
 *         return Expression(SymbolList, *[from_python(leaf) for leaf in arg])
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_arg);
    __pyx_r = __pyx_v_arg;
    goto __pyx_L0;

    /* "mathics/core/expression.py":143
 *     elif isinstance(arg, BaseExpression):
 *         return arg
 *     elif isinstance(arg, BoxConstruct):             # <<<<<<<<<<<<<<
 *         return arg
 *     elif isinstance(arg, list) or isinstance(arg, tuple):
 */
  }

  /* "mathics/core/expression.py":145
 *     elif isinstance(arg, BoxConstruct):
 *         return arg
 *     elif isinstance(arg, list) or isinstance(arg, tuple):             # <<<<<<<<<<<<<<
 *         return Expression(SymbolList, *[from_python(leaf) for leaf in arg])
 *     elif isinstance(arg, bytearray) or isinstance(arg, bytes):
 */
  __pyx_t_4 = PyList_Check(__pyx_v_arg); 
  __pyx_t_6 = (__pyx_t_4 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_6 = PyTuple_Check(__pyx_v_arg); 
  __pyx_t_4 = (__pyx_t_6 != 0);
  __pyx_t_5 = __pyx_t_4;
  __pyx_L16_bool_binop_done:;
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":146
 *         return arg
 *     elif isinstance(arg, list) or isinstance(arg, tuple):
 *         return Expression(SymbolList, *[from_python(leaf) for leaf in arg])             # <<<<<<<<<<<<<<
 *     elif isinstance(arg, bytearray) or isinstance(arg, bytes):
 *         return Expression(SymbolByteArray, ByteArrayAtom(arg))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
    __pyx_t_7 = 0;
    { /* enter inner scope */
      __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (likely(PyList_CheckExact(__pyx_v_arg)) || PyTuple_CheckExact(__pyx_v_arg)) {
        __pyx_t_8 = __pyx_v_arg; __Pyx_INCREF(__pyx_t_8); __pyx_t_12 = 0;
        __pyx_t_13 = NULL;
      } else {
        __pyx_t_12 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_arg); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 146, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_13 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 146, __pyx_L20_error)
      }
      for (;;) {
        if (likely(!__pyx_t_13)) {
          if (likely(PyList_CheckExact(__pyx_t_8))) {
            if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_8)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_14 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_12); __Pyx_INCREF(__pyx_t_14); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 146, __pyx_L20_error)
            #else
            __pyx_t_14 = PySequence_ITEM(__pyx_t_8, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 146, __pyx_L20_error)
            __Pyx_GOTREF(__pyx_t_14);
            #endif
          } else {
            if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_14 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_12); __Pyx_INCREF(__pyx_t_14); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 146, __pyx_L20_error)
            #else
            __pyx_t_14 = PySequence_ITEM(__pyx_t_8, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 146, __pyx_L20_error)
            __Pyx_GOTREF(__pyx_t_14);
            #endif
          }
        } else {
          __pyx_t_14 = __pyx_t_13(__pyx_t_8);
          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, 146, __pyx_L20_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_14);
        }
        __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_leaf, __pyx_t_14);
        __pyx_t_14 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_from_python); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_14 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_8genexpr3__pyx_v_leaf) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_8genexpr3__pyx_v_leaf);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 146, __pyx_L20_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_7, (PyObject*)__pyx_t_14))) __PYX_ERR(0, 146, __pyx_L20_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_leaf); __pyx_8genexpr3__pyx_v_leaf = 0;
      goto __pyx_L23_exit_scope;
      __pyx_L20_error:;
      __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_leaf); __pyx_8genexpr3__pyx_v_leaf = 0;
      goto __pyx_L1_error;
      __pyx_L23_exit_scope:;
    } /* exit inner scope */
    __pyx_t_8 = PySequence_Tuple(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":145
 *     elif isinstance(arg, BoxConstruct):
 *         return arg
 *     elif isinstance(arg, list) or isinstance(arg, tuple):             # <<<<<<<<<<<<<<
 *         return Expression(SymbolList, *[from_python(leaf) for leaf in arg])
 *     elif isinstance(arg, bytearray) or isinstance(arg, bytes):
 */
  }

  /* "mathics/core/expression.py":147
 *     elif isinstance(arg, list) or isinstance(arg, tuple):
 *         return Expression(SymbolList, *[from_python(leaf) for leaf in arg])
 *     elif isinstance(arg, bytearray) or isinstance(arg, bytes):             # <<<<<<<<<<<<<<
 *         return Expression(SymbolByteArray, ByteArrayAtom(arg))
 *     else:
 */
  __pyx_t_4 = PyByteArray_Check(__pyx_v_arg); 
  __pyx_t_6 = (__pyx_t_4 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L24_bool_binop_done;
  }
  __pyx_t_6 = PyBytes_Check(__pyx_v_arg); 
  __pyx_t_4 = (__pyx_t_6 != 0);
  __pyx_t_5 = __pyx_t_4;
  __pyx_L24_bool_binop_done:;
  if (likely(__pyx_t_5)) {

    /* "mathics/core/expression.py":148
 *         return Expression(SymbolList, *[from_python(leaf) for leaf in arg])
 *     elif isinstance(arg, bytearray) or isinstance(arg, bytes):
 *         return Expression(SymbolByteArray, ByteArrayAtom(arg))             # <<<<<<<<<<<<<<
 *     else:
 *         raise NotImplementedError
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Expression); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SymbolByteArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_ByteArrayAtom); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_3, __pyx_v_arg) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_arg);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_1, __pyx_t_2};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_1, __pyx_t_2};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_14) {
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_14); __pyx_t_14 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":147
 *     elif isinstance(arg, list) or isinstance(arg, tuple):
 *         return Expression(SymbolList, *[from_python(leaf) for leaf in arg])
 *     elif isinstance(arg, bytearray) or isinstance(arg, bytes):             # <<<<<<<<<<<<<<
 *         return Expression(SymbolByteArray, ByteArrayAtom(arg))
 *     else:
 */
  }

  /* "mathics/core/expression.py":150
 *         return Expression(SymbolByteArray, ByteArrayAtom(arg))
 *     else:
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
    __PYX_ERR(0, 150, __pyx_L1_error)
  }

  /* "mathics/core/expression.py":95
 * 
 * 
 * def from_python(arg):             # <<<<<<<<<<<<<<
 *     """Converts a Python expression into a Mathics expression.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("mathics.core.expression.from_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_BoxConstruct);
  __Pyx_XDECREF(__pyx_v_number_type);
  __Pyx_XDECREF(__pyx_v_entries);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_key);
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":154
 * 
 * class KeyComparable(object):
 *     def get_sort_key(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_1get_sort_key(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13KeyComparable_1get_sort_key = {"get_sort_key", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13KeyComparable_1get_sort_key, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_1get_sort_key(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sort_key (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13KeyComparable_get_sort_key(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":155
 * class KeyComparable(object):
 *     def get_sort_key(self):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def __lt__(self, other) -> bool:
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 155, __pyx_L1_error)

  /* "mathics/core/expression.py":154
 * 
 * class KeyComparable(object):
 *     def get_sort_key(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.KeyComparable.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":157
 *         raise NotImplementedError
 * 
 *     def __lt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() < other.get_sort_key()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_3__lt__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13KeyComparable_3__lt__ = {"__lt__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13KeyComparable_3__lt__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_3__lt__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__lt__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__lt__", 1, 2, 2, 1); __PYX_ERR(0, 157, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__lt__") < 0)) __PYX_ERR(0, 157, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__lt__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 157, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.KeyComparable.__lt__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13KeyComparable_2__lt__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_2__lt__(CYTHON_UNUSED PyObject *__pyx_self, 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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__lt__", 0);

  /* "mathics/core/expression.py":158
 * 
 *     def __lt__(self, other) -> bool:
 *         return self.get_sort_key() < other.get_sort_key()             # <<<<<<<<<<<<<<
 * 
 *     def __gt__(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __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, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":157
 *         raise NotImplementedError
 * 
 *     def __lt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() < other.get_sort_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("mathics.core.expression.KeyComparable.__lt__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":160
 *         return self.get_sort_key() < other.get_sort_key()
 * 
 *     def __gt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() > other.get_sort_key()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_5__gt__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13KeyComparable_5__gt__ = {"__gt__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13KeyComparable_5__gt__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_5__gt__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__gt__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__gt__", 1, 2, 2, 1); __PYX_ERR(0, 160, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__gt__") < 0)) __PYX_ERR(0, 160, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__gt__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 160, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.KeyComparable.__gt__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13KeyComparable_4__gt__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_4__gt__(CYTHON_UNUSED PyObject *__pyx_self, 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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__gt__", 0);

  /* "mathics/core/expression.py":161
 * 
 *     def __gt__(self, other) -> bool:
 *         return self.get_sort_key() > other.get_sort_key()             # <<<<<<<<<<<<<<
 * 
 *     def __le__(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __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, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":160
 *         return self.get_sort_key() < other.get_sort_key()
 * 
 *     def __gt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() > other.get_sort_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("mathics.core.expression.KeyComparable.__gt__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":163
 *         return self.get_sort_key() > other.get_sort_key()
 * 
 *     def __le__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() <= other.get_sort_key()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_7__le__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13KeyComparable_7__le__ = {"__le__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13KeyComparable_7__le__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_7__le__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__le__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__le__", 1, 2, 2, 1); __PYX_ERR(0, 163, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__le__") < 0)) __PYX_ERR(0, 163, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__le__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 163, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.KeyComparable.__le__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13KeyComparable_6__le__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_6__le__(CYTHON_UNUSED PyObject *__pyx_self, 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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__le__", 0);

  /* "mathics/core/expression.py":164
 * 
 *     def __le__(self, other) -> bool:
 *         return self.get_sort_key() <= other.get_sort_key()             # <<<<<<<<<<<<<<
 * 
 *     def __ge__(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __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, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":163
 *         return self.get_sort_key() > other.get_sort_key()
 * 
 *     def __le__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() <= other.get_sort_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("mathics.core.expression.KeyComparable.__le__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":166
 *         return self.get_sort_key() <= other.get_sort_key()
 * 
 *     def __ge__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() >= other.get_sort_key()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_9__ge__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13KeyComparable_9__ge__ = {"__ge__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13KeyComparable_9__ge__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_9__ge__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__ge__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__ge__", 1, 2, 2, 1); __PYX_ERR(0, 166, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__ge__") < 0)) __PYX_ERR(0, 166, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__ge__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 166, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.KeyComparable.__ge__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13KeyComparable_8__ge__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_8__ge__(CYTHON_UNUSED PyObject *__pyx_self, 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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__ge__", 0);

  /* "mathics/core/expression.py":167
 * 
 *     def __ge__(self, other) -> bool:
 *         return self.get_sort_key() >= other.get_sort_key()             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __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, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":166
 *         return self.get_sort_key() <= other.get_sort_key()
 * 
 *     def __ge__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() >= other.get_sort_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("mathics.core.expression.KeyComparable.__ge__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":169
 *         return self.get_sort_key() >= other.get_sort_key()
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             hasattr(other, "get_sort_key")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_11__eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13KeyComparable_11__eq__ = {"__eq__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13KeyComparable_11__eq__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_11__eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, 1); __PYX_ERR(0, 169, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__eq__") < 0)) __PYX_ERR(0, 169, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 169, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.KeyComparable.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13KeyComparable_10__eq__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":170
 * 
 *     def __eq__(self, other) -> bool:
 *         return (             # <<<<<<<<<<<<<<
 *             hasattr(other, "get_sort_key")
 *             and self.get_sort_key() == other.get_sort_key()
 */
  __Pyx_XDECREF(__pyx_r);

  /* "mathics/core/expression.py":171
 *     def __eq__(self, other) -> bool:
 *         return (
 *             hasattr(other, "get_sort_key")             # <<<<<<<<<<<<<<
 *             and self.get_sort_key() == other.get_sort_key()
 *         )
 */
  __pyx_t_2 = __Pyx_HasAttr(__pyx_v_other, __pyx_n_u_get_sort_key); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 171, __pyx_L1_error)
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":172
 *         return (
 *             hasattr(other, "get_sort_key")
 *             and self.get_sort_key() == other.get_sort_key()             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __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, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":169
 *         return self.get_sort_key() >= other.get_sort_key()
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             hasattr(other, "get_sort_key")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.KeyComparable.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":175
 *         )
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             not hasattr(other, "get_sort_key")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_13__ne__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13KeyComparable_13__ne__ = {"__ne__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13KeyComparable_13__ne__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13KeyComparable_13__ne__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__ne__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__ne__", 1, 2, 2, 1); __PYX_ERR(0, 175, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__ne__") < 0)) __PYX_ERR(0, 175, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__ne__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 175, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.KeyComparable.__ne__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13KeyComparable_12__ne__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13KeyComparable_12__ne__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__ne__", 0);

  /* "mathics/core/expression.py":176
 * 
 *     def __ne__(self, other) -> bool:
 *         return (             # <<<<<<<<<<<<<<
 *             not hasattr(other, "get_sort_key")
 *         ) or self.get_sort_key() != other.get_sort_key()
 */
  __Pyx_XDECREF(__pyx_r);

  /* "mathics/core/expression.py":177
 *     def __ne__(self, other) -> bool:
 *         return (
 *             not hasattr(other, "get_sort_key")             # <<<<<<<<<<<<<<
 *         ) or self.get_sort_key() != other.get_sort_key()
 * 
 */
  __pyx_t_2 = __Pyx_HasAttr(__pyx_v_other, __pyx_n_u_get_sort_key); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 177, __pyx_L1_error)
  __pyx_t_3 = (!(__pyx_t_2 != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":178
 *         return (
 *             not hasattr(other, "get_sort_key")
 *         ) or self.get_sort_key() != other.get_sort_key()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_1 = __pyx_t_6;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":175
 *         )
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             not hasattr(other, "get_sort_key")
 */

  /* 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("mathics.core.expression.KeyComparable.__ne__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":196
 * 
 * class ExpressionCache:
 *     def __init__(self, time=None, symbols=None, sequences=None, copy=None):             # <<<<<<<<<<<<<<
 *         if copy is not None:
 *             time = time or copy.time
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_15ExpressionCache_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_15ExpressionCache_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_15ExpressionCache_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_15ExpressionCache_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_time = 0;
  PyObject *__pyx_v_symbols = 0;
  PyObject *__pyx_v_sequences = 0;
  PyObject *__pyx_v_copy = 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_time,&__pyx_n_s_symbols,&__pyx_n_s_sequences,&__pyx_n_s_copy,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_time);
          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_symbols);
          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_sequences);
          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_copy);
          if (value) { values[4] = 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, 196, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_time = values[1];
    __pyx_v_symbols = values[2];
    __pyx_v_sequences = values[3];
    __pyx_v_copy = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 196, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ExpressionCache.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_15ExpressionCache___init__(__pyx_self, __pyx_v_self, __pyx_v_time, __pyx_v_symbols, __pyx_v_sequences, __pyx_v_copy);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_time, PyObject *__pyx_v_symbols, PyObject *__pyx_v_sequences, PyObject *__pyx_v_copy) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_INCREF(__pyx_v_time);
  __Pyx_INCREF(__pyx_v_symbols);
  __Pyx_INCREF(__pyx_v_sequences);

  /* "mathics/core/expression.py":197
 * class ExpressionCache:
 *     def __init__(self, time=None, symbols=None, sequences=None, copy=None):
 *         if copy is not None:             # <<<<<<<<<<<<<<
 *             time = time or copy.time
 *             symbols = symbols or copy.symbols
 */
  __pyx_t_1 = (__pyx_v_copy != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":198
 *     def __init__(self, time=None, symbols=None, sequences=None, copy=None):
 *         if copy is not None:
 *             time = time or copy.time             # <<<<<<<<<<<<<<
 *             symbols = symbols or copy.symbols
 *             sequences = sequences or copy.sequences
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_time); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 198, __pyx_L1_error)
    if (!__pyx_t_2) {
    } else {
      __Pyx_INCREF(__pyx_v_time);
      __pyx_t_3 = __pyx_v_time;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_copy, __pyx_n_s_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_L4_bool_binop_done:;
    __Pyx_DECREF_SET(__pyx_v_time, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":199
 *         if copy is not None:
 *             time = time or copy.time
 *             symbols = symbols or copy.symbols             # <<<<<<<<<<<<<<
 *             sequences = sequences or copy.sequences
 *         self.time = time
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_symbols); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 199, __pyx_L1_error)
    if (!__pyx_t_2) {
    } else {
      __Pyx_INCREF(__pyx_v_symbols);
      __pyx_t_3 = __pyx_v_symbols;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_copy, __pyx_n_s_symbols); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_L6_bool_binop_done:;
    __Pyx_DECREF_SET(__pyx_v_symbols, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":200
 *             time = time or copy.time
 *             symbols = symbols or copy.symbols
 *             sequences = sequences or copy.sequences             # <<<<<<<<<<<<<<
 *         self.time = time
 *         self.symbols = symbols
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_sequences); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 200, __pyx_L1_error)
    if (!__pyx_t_2) {
    } else {
      __Pyx_INCREF(__pyx_v_sequences);
      __pyx_t_3 = __pyx_v_sequences;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_copy, __pyx_n_s_sequences); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_L8_bool_binop_done:;
    __Pyx_DECREF_SET(__pyx_v_sequences, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":197
 * class ExpressionCache:
 *     def __init__(self, time=None, symbols=None, sequences=None, copy=None):
 *         if copy is not None:             # <<<<<<<<<<<<<<
 *             time = time or copy.time
 *             symbols = symbols or copy.symbols
 */
  }

  /* "mathics/core/expression.py":201
 *             symbols = symbols or copy.symbols
 *             sequences = sequences or copy.sequences
 *         self.time = time             # <<<<<<<<<<<<<<
 *         self.symbols = symbols
 *         self.sequences = sequences
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_time, __pyx_v_time) < 0) __PYX_ERR(0, 201, __pyx_L1_error)

  /* "mathics/core/expression.py":202
 *             sequences = sequences or copy.sequences
 *         self.time = time
 *         self.symbols = symbols             # <<<<<<<<<<<<<<
 *         self.sequences = sequences
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_symbols, __pyx_v_symbols) < 0) __PYX_ERR(0, 202, __pyx_L1_error)

  /* "mathics/core/expression.py":203
 *         self.time = time
 *         self.symbols = symbols
 *         self.sequences = sequences             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sequences, __pyx_v_sequences) < 0) __PYX_ERR(0, 203, __pyx_L1_error)

  /* "mathics/core/expression.py":196
 * 
 * class ExpressionCache:
 *     def __init__(self, time=None, symbols=None, sequences=None, copy=None):             # <<<<<<<<<<<<<<
 *         if copy is not None:
 *             time = time or copy.time
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.ExpressionCache.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_time);
  __Pyx_XDECREF(__pyx_v_symbols);
  __Pyx_XDECREF(__pyx_v_sequences);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":205
 *         self.sequences = sequences
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return ExpressionCache(self.time, self.symbols, self.sequences)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_15ExpressionCache_3copy(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_15ExpressionCache_3copy = {"copy", (PyCFunction)__pyx_pw_7mathics_4core_10expression_15ExpressionCache_3copy, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_15ExpressionCache_3copy(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_15ExpressionCache_2copy(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":206
 * 
 *     def copy(self):
 *         return ExpressionCache(self.time, self.symbols, self.sequences)             # <<<<<<<<<<<<<<
 * 
 *     def sliced(self, lower, upper):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ExpressionCache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_symbols); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sequences); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __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_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 206, __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_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":205
 *         self.sequences = sequences
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return ExpressionCache(self.time, self.symbols, self.sequences)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.core.expression.ExpressionCache.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":208
 *         return ExpressionCache(self.time, self.symbols, self.sequences)
 * 
 *     def sliced(self, lower, upper):             # <<<<<<<<<<<<<<
 *         # indicates that the Expression's leaves have been slices with
 *         # the given indices.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_15ExpressionCache_5sliced(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_15ExpressionCache_5sliced = {"sliced", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_15ExpressionCache_5sliced, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_15ExpressionCache_5sliced(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_lower = 0;
  PyObject *__pyx_v_upper = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sliced (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_lower,&__pyx_n_s_upper,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lower)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sliced", 1, 3, 3, 1); __PYX_ERR(0, 208, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_upper)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sliced", 1, 3, 3, 2); __PYX_ERR(0, 208, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sliced") < 0)) __PYX_ERR(0, 208, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_lower = values[1];
    __pyx_v_upper = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sliced", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 208, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ExpressionCache.sliced", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_15ExpressionCache_4sliced(__pyx_self, __pyx_v_self, __pyx_v_lower, __pyx_v_upper);

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

/* "mathics/core/expression.py":217
 *             a = bisect_left(seq, lower)  # all(val >= i for val in seq[a:])
 *             b = bisect_left(seq, upper)  # all(val >= j for val in seq[b:])
 *             new_sequences = tuple(x - lower for x in seq[a:b])             # <<<<<<<<<<<<<<
 *         elif seq is not None:
 *             new_sequences = tuple()
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache_6sliced_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___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_7mathics_4core_10expression___pyx_scope_struct_1_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_1_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 217, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *) __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_7mathics_4core_10expression_15ExpressionCache_6sliced_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_ExpressionCache_sliced_locals_ge, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 217, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.ExpressionCache.sliced.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_7mathics_4core_10expression_15ExpressionCache_6sliced_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  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, 217, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_seq)) { __Pyx_RaiseClosureNameError("seq"); __PYX_ERR(0, 217, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a)) { __Pyx_RaiseClosureNameError("a"); __PYX_ERR(0, 217, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_b)) { __Pyx_RaiseClosureNameError("b"); __PYX_ERR(0, 217, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_seq, 0, 0, &__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a, &__pyx_cur_scope->__pyx_outer_scope->__pyx_v_b, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 217, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 217, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_lower)) { __Pyx_RaiseClosureNameError("lower"); __PYX_ERR(0, 217, __pyx_L1_error) }
    __pyx_t_1 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_x, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_lower); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 217, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

/* "mathics/core/expression.py":208
 *         return ExpressionCache(self.time, self.symbols, self.sequences)
 * 
 *     def sliced(self, lower, upper):             # <<<<<<<<<<<<<<
 *         # indicates that the Expression's leaves have been slices with
 *         # the given indices.
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache_4sliced(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_lower, PyObject *__pyx_v_upper) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *__pyx_cur_scope;
  PyObject *__pyx_v_new_sequences = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sliced", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct__sliced(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct__sliced, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 208, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_lower = __pyx_v_lower;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lower);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lower);

  /* "mathics/core/expression.py":212
 *         # the given indices.
 * 
 *         seq = self.sequences             # <<<<<<<<<<<<<<
 * 
 *         if seq:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sequences); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_seq = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":214
 *         seq = self.sequences
 * 
 *         if seq:             # <<<<<<<<<<<<<<
 *             a = bisect_left(seq, lower)  # all(val >= i for val in seq[a:])
 *             b = bisect_left(seq, upper)  # all(val >= j for val in seq[b:])
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_seq); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 214, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":215
 * 
 *         if seq:
 *             a = bisect_left(seq, lower)  # all(val >= i for val in seq[a:])             # <<<<<<<<<<<<<<
 *             b = bisect_left(seq, upper)  # all(val >= j for val in seq[b:])
 *             new_sequences = tuple(x - lower for x in seq[a:b])
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_bisect_left); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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_cur_scope->__pyx_v_seq, __pyx_cur_scope->__pyx_v_lower};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_seq, __pyx_cur_scope->__pyx_v_lower};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 215, __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_cur_scope->__pyx_v_seq);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_seq);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_cur_scope->__pyx_v_seq);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lower);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lower);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_lower);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_v_a = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":216
 *         if seq:
 *             a = bisect_left(seq, lower)  # all(val >= i for val in seq[a:])
 *             b = bisect_left(seq, upper)  # all(val >= j for val in seq[b:])             # <<<<<<<<<<<<<<
 *             new_sequences = tuple(x - lower for x in seq[a:b])
 *         elif seq is not None:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_bisect_left); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_seq, __pyx_v_upper};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_seq, __pyx_v_upper};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_seq);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_seq);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_cur_scope->__pyx_v_seq);
      __Pyx_INCREF(__pyx_v_upper);
      __Pyx_GIVEREF(__pyx_v_upper);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_upper);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_v_b = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":217
 *             a = bisect_left(seq, lower)  # all(val >= i for val in seq[a:])
 *             b = bisect_left(seq, upper)  # all(val >= j for val in seq[b:])
 *             new_sequences = tuple(x - lower for x in seq[a:b])             # <<<<<<<<<<<<<<
 *         elif seq is not None:
 *             new_sequences = tuple()
 */
    __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_15ExpressionCache_6sliced_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_new_sequences = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":214
 *         seq = self.sequences
 * 
 *         if seq:             # <<<<<<<<<<<<<<
 *             a = bisect_left(seq, lower)  # all(val >= i for val in seq[a:])
 *             b = bisect_left(seq, upper)  # all(val >= j for val in seq[b:])
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":218
 *             b = bisect_left(seq, upper)  # all(val >= j for val in seq[b:])
 *             new_sequences = tuple(x - lower for x in seq[a:b])
 *         elif seq is not None:             # <<<<<<<<<<<<<<
 *             new_sequences = tuple()
 *         else:
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_seq != Py_None);
  __pyx_t_7 = (__pyx_t_2 != 0);
  if (__pyx_t_7) {

    /* "mathics/core/expression.py":219
 *             new_sequences = tuple(x - lower for x in seq[a:b])
 *         elif seq is not None:
 *             new_sequences = tuple()             # <<<<<<<<<<<<<<
 *         else:
 *             new_sequences = None
 */
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyTuple_Type))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_new_sequences = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":218
 *             b = bisect_left(seq, upper)  # all(val >= j for val in seq[b:])
 *             new_sequences = tuple(x - lower for x in seq[a:b])
 *         elif seq is not None:             # <<<<<<<<<<<<<<
 *             new_sequences = tuple()
 *         else:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":221
 *             new_sequences = tuple()
 *         else:
 *             new_sequences = None             # <<<<<<<<<<<<<<
 * 
 *         return ExpressionCache(self.time, self.symbols, new_sequences)
 */
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __pyx_v_new_sequences = ((PyObject*)Py_None);
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":223
 *             new_sequences = None
 * 
 *         return ExpressionCache(self.time, self.symbols, new_sequences)             # <<<<<<<<<<<<<<
 * 
 *     def reordered(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ExpressionCache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_symbols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_4, __pyx_t_6, __pyx_v_new_sequences};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_4, __pyx_t_6, __pyx_v_new_sequences};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_9 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_5, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_5, __pyx_t_6);
    __Pyx_INCREF(__pyx_v_new_sequences);
    __Pyx_GIVEREF(__pyx_v_new_sequences);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_5, __pyx_v_new_sequences);
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":208
 *         return ExpressionCache(self.time, self.symbols, self.sequences)
 * 
 *     def sliced(self, lower, upper):             # <<<<<<<<<<<<<<
 *         # indicates that the Expression's leaves have been slices with
 *         # the given indices.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.core.expression.ExpressionCache.sliced", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new_sequences);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":225
 *         return ExpressionCache(self.time, self.symbols, new_sequences)
 * 
 *     def reordered(self):             # <<<<<<<<<<<<<<
 *         # indicates that the Expression's leaves have been reordered
 *         # or reduced (i.e. that the leaves have changed, but that
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_15ExpressionCache_7reordered(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_15ExpressionCache_7reordered = {"reordered", (PyCFunction)__pyx_pw_7mathics_4core_10expression_15ExpressionCache_7reordered, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_15ExpressionCache_7reordered(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reordered (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_15ExpressionCache_6reordered(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache_6reordered(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_sequences = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reordered", 0);

  /* "mathics/core/expression.py":230
 *         # no new leaf instances were added).
 * 
 *         sequences = self.sequences             # <<<<<<<<<<<<<<
 * 
 *         # note that we keep sequences == [], since they are fine even
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sequences); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sequences = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":234
 *         # note that we keep sequences == [], since they are fine even
 *         # after having reordered leaves.
 *         if sequences:             # <<<<<<<<<<<<<<
 *             sequences = None
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_sequences); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 234, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":235
 *         # after having reordered leaves.
 *         if sequences:
 *             sequences = None             # <<<<<<<<<<<<<<
 * 
 *         return ExpressionCache(None, self.symbols, sequences)
 */
    __Pyx_INCREF(Py_None);
    __Pyx_DECREF_SET(__pyx_v_sequences, Py_None);

    /* "mathics/core/expression.py":234
 *         # note that we keep sequences == [], since they are fine even
 *         # after having reordered leaves.
 *         if sequences:             # <<<<<<<<<<<<<<
 *             sequences = None
 * 
 */
  }

  /* "mathics/core/expression.py":237
 *             sequences = None
 * 
 *         return ExpressionCache(None, self.symbols, sequences)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ExpressionCache); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_symbols); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, Py_None, __pyx_t_4, __pyx_v_sequences};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, Py_None, __pyx_t_4, __pyx_v_sequences};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, Py_None);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_sequences);
    __Pyx_GIVEREF(__pyx_v_sequences);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_sequences);
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":225
 *         return ExpressionCache(self.time, self.symbols, new_sequences)
 * 
 *     def reordered(self):             # <<<<<<<<<<<<<<
 *         # indicates that the Expression's leaves have been reordered
 *         # or reduced (i.e. that the leaves have changed, but that
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.ExpressionCache.reordered", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sequences);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":240
 * 
 *     @staticmethod
 *     def union(expressions, evaluation):             # <<<<<<<<<<<<<<
 *         definitions = evaluation.definitions
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_15ExpressionCache_9union(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_15ExpressionCache_9union = {"union", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_15ExpressionCache_9union, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_15ExpressionCache_9union(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_expressions = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("union (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_expressions,&__pyx_n_s_evaluation,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_expressions)) != 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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("union", 1, 2, 2, 1); __PYX_ERR(0, 240, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "union") < 0)) __PYX_ERR(0, 240, __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_expressions = values[0];
    __pyx_v_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("union", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 240, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ExpressionCache.union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_15ExpressionCache_8union(__pyx_self, __pyx_v_expressions, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_15ExpressionCache_8union(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_expressions, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_definitions = NULL;
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_v_symbols = NULL;
  PyObject *__pyx_8genexpr5__pyx_v_expr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("union", 0);

  /* "mathics/core/expression.py":241
 *     @staticmethod
 *     def union(expressions, evaluation):
 *         definitions = evaluation.definitions             # <<<<<<<<<<<<<<
 * 
 *         for expr in expressions:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_definitions = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":243
 *         definitions = evaluation.definitions
 * 
 *         for expr in expressions:             # <<<<<<<<<<<<<<
 *             if expr.has_changed(definitions):
 *                 return None
 */
  if (likely(PyList_CheckExact(__pyx_v_expressions)) || PyTuple_CheckExact(__pyx_v_expressions)) {
    __pyx_t_1 = __pyx_v_expressions; __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_expressions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __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, 243, __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, 243, __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, 243, __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, 243, __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, 243, __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, 243, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_expr, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":244
 * 
 *         for expr in expressions:
 *             if expr.has_changed(definitions):             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_has_changed); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_definitions) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_definitions);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":245
 *         for expr in expressions:
 *             if expr.has_changed(definitions):
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         symbols = set.union(*[expr._cache.symbols for expr in expressions])
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":244
 * 
 *         for expr in expressions:
 *             if expr.has_changed(definitions):             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    }

    /* "mathics/core/expression.py":243
 *         definitions = evaluation.definitions
 * 
 *         for expr in expressions:             # <<<<<<<<<<<<<<
 *             if expr.has_changed(definitions):
 *                 return None
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":247
 *                 return None
 * 
 *         symbols = set.union(*[expr._cache.symbols for expr in expressions])             # <<<<<<<<<<<<<<
 * 
 *         return ExpressionCache(
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PySet_Type)), __pyx_n_s_union); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  { /* enter inner scope */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L8_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_v_expressions)) || PyTuple_CheckExact(__pyx_v_expressions)) {
      __pyx_t_5 = __pyx_v_expressions; __Pyx_INCREF(__pyx_t_5); __pyx_t_2 = 0;
      __pyx_t_3 = NULL;
    } else {
      __pyx_t_2 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_expressions); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 247, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L8_error)
    }
    for (;;) {
      if (likely(!__pyx_t_3)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L8_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L8_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __pyx_L8_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_3(__pyx_t_5);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 247, __pyx_L8_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_expr, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr5__pyx_v_expr, __pyx_n_s_cache); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_symbols); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 247, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 247, __pyx_L8_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_expr); __pyx_8genexpr5__pyx_v_expr = 0;
    goto __pyx_L11_exit_scope;
    __pyx_L8_error:;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_expr); __pyx_8genexpr5__pyx_v_expr = 0;
    goto __pyx_L1_error;
    __pyx_L11_exit_scope:;
  } /* exit inner scope */
  __pyx_t_5 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_symbols = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "mathics/core/expression.py":249
 *         symbols = set.union(*[expr._cache.symbols for expr in expressions])
 * 
 *         return ExpressionCache(             # <<<<<<<<<<<<<<
 *             definitions.now, symbols, None if "System`Sequence" in symbols else tuple()
 *         )
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ExpressionCache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "mathics/core/expression.py":250
 * 
 *         return ExpressionCache(
 *             definitions.now, symbols, None if "System`Sequence" in symbols else tuple()             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_definitions, __pyx_n_s_now); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_Sequence, __pyx_v_symbols, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 250, __pyx_L1_error)
  if ((__pyx_t_7 != 0)) {
    __Pyx_INCREF(Py_None);
    __pyx_t_8 = Py_None;
  } else {
    __pyx_t_6 = __Pyx_PyObject_CallNoArg(((PyObject *)(&PyTuple_Type))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __pyx_t_6;
    __pyx_t_6 = 0;
  }
  __pyx_t_6 = NULL;
  __pyx_t_9 = 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_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_1, __pyx_v_symbols, __pyx_t_8};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_1, __pyx_v_symbols, __pyx_t_8};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_symbols);
    __Pyx_GIVEREF(__pyx_v_symbols);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_symbols);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_8);
    __pyx_t_1 = 0;
    __pyx_t_8 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":240
 * 
 *     @staticmethod
 *     def union(expressions, evaluation):             # <<<<<<<<<<<<<<
 *         definitions = evaluation.definitions
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.ExpressionCache.union", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_definitions);
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_symbols);
  __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_expr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":260
 *     last_evaluated: Any
 * 
 *     def __new__(cls, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self = object.__new__(cls)
 *         self.options = None
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED 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("__new__ (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_cls,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_cls)) != 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, "__new__") < 0)) __PYX_ERR(0, 260, __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_cls = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 260, __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("mathics.core.expression.BaseExpression.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression___new__(__pyx_self, __pyx_v_cls, __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_7mathics_4core_10expression_14BaseExpression___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_self = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);

  /* "mathics/core/expression.py":261
 * 
 *     def __new__(cls, *args, **kwargs):
 *         self = object.__new__(cls)             # <<<<<<<<<<<<<<
 *         self.options = None
 *         self.pattern_sequence = False
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_object, __pyx_n_s_new_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __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_cls) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_cls);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":262
 *     def __new__(cls, *args, **kwargs):
 *         self = object.__new__(cls)
 *         self.options = None             # <<<<<<<<<<<<<<
 *         self.pattern_sequence = False
 *         self.unformatted = self
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_options, Py_None) < 0) __PYX_ERR(0, 262, __pyx_L1_error)

  /* "mathics/core/expression.py":263
 *         self = object.__new__(cls)
 *         self.options = None
 *         self.pattern_sequence = False             # <<<<<<<<<<<<<<
 *         self.unformatted = self
 *         self._cache = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pattern_sequence, Py_False) < 0) __PYX_ERR(0, 263, __pyx_L1_error)

  /* "mathics/core/expression.py":264
 *         self.options = None
 *         self.pattern_sequence = False
 *         self.unformatted = self             # <<<<<<<<<<<<<<
 *         self._cache = None
 *         return self
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_unformatted, __pyx_v_self) < 0) __PYX_ERR(0, 264, __pyx_L1_error)

  /* "mathics/core/expression.py":265
 *         self.pattern_sequence = False
 *         self.unformatted = self
 *         self._cache = None             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cache, Py_None) < 0) __PYX_ERR(0, 265, __pyx_L1_error)

  /* "mathics/core/expression.py":266
 *         self.unformatted = self
 *         self._cache = None
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def clear_cache(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":260
 *     last_evaluated: Any
 * 
 *     def __new__(cls, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self = object.__new__(cls)
 *         self.options = None
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":268
 *         return self
 * 
 *     def clear_cache(self):             # <<<<<<<<<<<<<<
 *         self._cache = None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_3clear_cache(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_3clear_cache = {"clear_cache", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_3clear_cache, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_3clear_cache(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_cache (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_2clear_cache(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":269
 * 
 *     def clear_cache(self):
 *         self._cache = None             # <<<<<<<<<<<<<<
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cache, Py_None) < 0) __PYX_ERR(0, 269, __pyx_L1_error)

  /* "mathics/core/expression.py":268
 *         return self
 * 
 *     def clear_cache(self):             # <<<<<<<<<<<<<<
 *         self._cache = None
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.clear_cache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":271
 *         self._cache = None
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_5equal2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_14BaseExpression_4equal2[] = "Mathics two-argument Equal (==)\n        returns True if self and rhs are identical.\n        ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_5equal2 = {"equal2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_5equal2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_14BaseExpression_4equal2};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_5equal2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_rhs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("equal2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rhs,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_rhs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("equal2", 1, 2, 2, 1); __PYX_ERR(0, 271, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "equal2") < 0)) __PYX_ERR(0, 271, __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_rhs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("equal2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.equal2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_4equal2(__pyx_self, __pyx_v_self, __pyx_v_rhs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_4equal2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) {
  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("equal2", 0);

  /* "mathics/core/expression.py":275
 *         returns True if self and rhs are identical.
 *         """
 *         if self.sameQ(rhs):             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __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_rhs) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_rhs);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":276
 *         """
 *         if self.sameQ(rhs):
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         # If the types are the same then we'll use the classes definition of == (or __eq__).
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":275
 *         returns True if self and rhs are identical.
 *         """
 *         if self.sameQ(rhs):             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  }

  /* "mathics/core/expression.py":282
 *         #
 *         # I would use `is` instead `==` here, to compare classes.
 *         if type(self) is type(rhs):             # <<<<<<<<<<<<<<
 *             return self == rhs
 *         return None
 */
  __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_self)) == ((PyObject *)Py_TYPE(__pyx_v_rhs)));
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":283
 *         # I would use `is` instead `==` here, to compare classes.
 *         if type(self) is type(rhs):
 *             return self == rhs             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_self, __pyx_v_rhs, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error)
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":282
 *         #
 *         # I would use `is` instead `==` here, to compare classes.
 *         if type(self) is type(rhs):             # <<<<<<<<<<<<<<
 *             return self == rhs
 *         return None
 */
  }

  /* "mathics/core/expression.py":284
 *         if type(self) is type(rhs):
 *             return self == rhs
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def has_changed(self, definitions):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":271
 *         self._cache = None
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.equal2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":286
 *         return None
 * 
 *     def has_changed(self, definitions):             # <<<<<<<<<<<<<<
 *         return True
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_7has_changed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_7has_changed = {"has_changed", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_7has_changed, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_7has_changed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_definitions = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_changed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_definitions,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_definitions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("has_changed", 1, 2, 2, 1); __PYX_ERR(0, 286, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "has_changed") < 0)) __PYX_ERR(0, 286, __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_definitions = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_changed", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 286, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.has_changed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_6has_changed(__pyx_self, __pyx_v_self, __pyx_v_definitions);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_6has_changed(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_definitions) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_changed", 0);

  /* "mathics/core/expression.py":287
 * 
 *     def has_changed(self, definitions):
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def sequences(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "mathics/core/expression.py":286
 *         return None
 * 
 *     def has_changed(self, definitions):             # <<<<<<<<<<<<<<
 *         return True
 * 
 */

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

/* "mathics/core/expression.py":289
 *         return True
 * 
 *     def sequences(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_9sequences(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_9sequences = {"sequences", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_9sequences, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_9sequences(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sequences (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_8sequences(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_8sequences(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sequences", 0);

  /* "mathics/core/expression.py":290
 * 
 *     def sequences(self):
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def flatten_sequence(self, evaluation) -> "BaseExpression":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":289
 *         return True
 * 
 *     def sequences(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "mathics/core/expression.py":292
 *         return None
 * 
 *     def flatten_sequence(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_11flatten_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_11flatten_sequence = {"flatten_sequence", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_11flatten_sequence, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_11flatten_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flatten_sequence (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("flatten_sequence", 1, 2, 2, 1); __PYX_ERR(0, 292, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flatten_sequence") < 0)) __PYX_ERR(0, 292, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("flatten_sequence", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 292, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.flatten_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_10flatten_sequence(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_10flatten_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flatten_sequence", 0);

  /* "mathics/core/expression.py":293
 * 
 *     def flatten_sequence(self, evaluation) -> "BaseExpression":
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def flatten_pattern_sequence(self, evaluation) -> "BaseExpression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":292
 *         return None
 * 
 *     def flatten_sequence(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "mathics/core/expression.py":295
 *         return self
 * 
 *     def flatten_pattern_sequence(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_13flatten_pattern_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_13flatten_pattern_sequence = {"flatten_pattern_sequence", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_13flatten_pattern_sequence, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_13flatten_pattern_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flatten_pattern_sequence (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("flatten_pattern_sequence", 1, 2, 2, 1); __PYX_ERR(0, 295, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flatten_pattern_sequence") < 0)) __PYX_ERR(0, 295, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("flatten_pattern_sequence", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 295, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.flatten_pattern_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_12flatten_pattern_sequence(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_12flatten_pattern_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flatten_pattern_sequence", 0);

  /* "mathics/core/expression.py":296
 * 
 *     def flatten_pattern_sequence(self, evaluation) -> "BaseExpression":
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def get_attributes(self, definitions):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":295
 *         return self
 * 
 *     def flatten_pattern_sequence(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "mathics/core/expression.py":298
 *         return self
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         return set()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_15get_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_15get_attributes = {"get_attributes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_15get_attributes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_15get_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_definitions = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_attributes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_definitions,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_definitions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_attributes", 1, 2, 2, 1); __PYX_ERR(0, 298, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_attributes") < 0)) __PYX_ERR(0, 298, __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_definitions = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_attributes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 298, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.get_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_14get_attributes(__pyx_self, __pyx_v_self, __pyx_v_definitions);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_14get_attributes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_definitions) {
  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_attributes", 0);

  /* "mathics/core/expression.py":299
 * 
 *     def get_attributes(self, definitions):
 *         return set()             # <<<<<<<<<<<<<<
 * 
 *     def evaluate_next(self, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":298
 *         return self
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         return set()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.get_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":301
 *         return set()
 * 
 *     def evaluate_next(self, evaluation):             # <<<<<<<<<<<<<<
 *         return self.evaluate(evaluation), False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_17evaluate_next(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_17evaluate_next = {"evaluate_next", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_17evaluate_next, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_17evaluate_next(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_next (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_next", 1, 2, 2, 1); __PYX_ERR(0, 301, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate_next") < 0)) __PYX_ERR(0, 301, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate_next", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 301, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.evaluate_next", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_16evaluate_next(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_16evaluate_next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  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("evaluate_next", 0);

  /* "mathics/core/expression.py":302
 * 
 *     def evaluate_next(self, evaluation):
 *         return self.evaluate(evaluation), False             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, evaluation) -> "BaseExpression":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __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_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_False);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":301
 *         return set()
 * 
 *     def evaluate_next(self, evaluation):             # <<<<<<<<<<<<<<
 *         return self.evaluate(evaluation), False
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.evaluate_next", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":304
 *         return self.evaluate(evaluation), False
 * 
 *     def evaluate(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_19evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_19evaluate = {"evaluate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_19evaluate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_19evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); __PYX_ERR(0, 304, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) __PYX_ERR(0, 304, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 304, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_18evaluate(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_18evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  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("evaluate", 0);

  /* "mathics/core/expression.py":305
 * 
 *     def evaluate(self, evaluation) -> "BaseExpression":
 *         evaluation.check_stopped()             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_check_stopped); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __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, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":306
 *     def evaluate(self, evaluation) -> "BaseExpression":
 *         evaluation.check_stopped()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def get_atoms(self, include_heads=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":304
 *         return self.evaluate(evaluation), False
 * 
 *     def evaluate(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":308
 *         return self
 * 
 *     def get_atoms(self, include_heads=True):             # <<<<<<<<<<<<<<
 *         return []
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_21get_atoms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_21get_atoms = {"get_atoms", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_21get_atoms, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_21get_atoms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_include_heads = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_atoms (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_include_heads,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_include_heads);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_atoms") < 0)) __PYX_ERR(0, 308, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_include_heads = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_atoms", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 308, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.get_atoms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_20get_atoms(__pyx_self, __pyx_v_self, __pyx_v_include_heads);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_20get_atoms(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_include_heads) {
  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_atoms", 0);

  /* "mathics/core/expression.py":309
 * 
 *     def get_atoms(self, include_heads=True):
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     def get_name(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":308
 *         return self
 * 
 *     def get_atoms(self, include_heads=True):             # <<<<<<<<<<<<<<
 *         return []
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.get_atoms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":311
 *         return []
 * 
 *     def get_name(self):             # <<<<<<<<<<<<<<
 *         "Returns symbol's name if Symbol instance"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_23get_name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_14BaseExpression_22get_name[] = "Returns symbol's name if Symbol instance";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_23get_name = {"get_name", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_23get_name, METH_O, __pyx_doc_7mathics_4core_10expression_14BaseExpression_22get_name};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_23get_name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_name (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_22get_name(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_22get_name(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_name", 0);

  /* "mathics/core/expression.py":314
 *         "Returns symbol's name if Symbol instance"
 * 
 *         return ""             # <<<<<<<<<<<<<<
 * 
 *     def is_symbol(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_kp_u__3);
  __pyx_r = __pyx_kp_u__3;
  goto __pyx_L0;

  /* "mathics/core/expression.py":311
 *         return []
 * 
 *     def get_name(self):             # <<<<<<<<<<<<<<
 *         "Returns symbol's name if Symbol instance"
 * 
 */

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

/* "mathics/core/expression.py":316
 *         return ""
 * 
 *     def is_symbol(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_25is_symbol(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_25is_symbol = {"is_symbol", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_25is_symbol, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_25is_symbol(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_symbol (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_24is_symbol(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_24is_symbol(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_symbol", 0);

  /* "mathics/core/expression.py":317
 * 
 *     def is_symbol(self) -> bool:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def is_machine_precision(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":316
 *         return ""
 * 
 *     def is_symbol(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

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

/* "mathics/core/expression.py":319
 *         return False
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_27is_machine_precision(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_27is_machine_precision = {"is_machine_precision", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_27is_machine_precision, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_27is_machine_precision(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_machine_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_26is_machine_precision(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_26is_machine_precision(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_machine_precision", 0);

  /* "mathics/core/expression.py":320
 * 
 *     def is_machine_precision(self) -> bool:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def get_lookup_name(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":319
 *         return False
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

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

/* "mathics/core/expression.py":322
 *         return False
 * 
 *     def get_lookup_name(self):             # <<<<<<<<<<<<<<
 *         "Returns symbol name of leftmost head"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_29get_lookup_name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_14BaseExpression_28get_lookup_name[] = "Returns symbol name of leftmost head";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_29get_lookup_name = {"get_lookup_name", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_29get_lookup_name, METH_O, __pyx_doc_7mathics_4core_10expression_14BaseExpression_28get_lookup_name};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_29get_lookup_name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_lookup_name (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_28get_lookup_name(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":325
 *         "Returns symbol name of leftmost head"
 * 
 *         return self.get_name()             # <<<<<<<<<<<<<<
 * 
 *     def get_head(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __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, 325, __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;

  /* "mathics/core/expression.py":322
 *         return False
 * 
 *     def get_lookup_name(self):             # <<<<<<<<<<<<<<
 *         "Returns symbol name of leftmost head"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.get_lookup_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":327
 *         return self.get_name()
 * 
 *     def get_head(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_31get_head(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_31get_head = {"get_head", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_31get_head, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_31get_head(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_head (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_30get_head(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_30get_head(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_head", 0);

  /* "mathics/core/expression.py":328
 * 
 *     def get_head(self):
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def get_head_name(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":327
 *         return self.get_name()
 * 
 *     def get_head(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "mathics/core/expression.py":330
 *         return None
 * 
 *     def get_head_name(self):             # <<<<<<<<<<<<<<
 *         return self.get_head().get_name()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_33get_head_name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_33get_head_name = {"get_head_name", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_33get_head_name, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_33get_head_name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_head_name (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_32get_head_name(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":331
 * 
 *     def get_head_name(self):
 *         return self.get_head().get_name()             # <<<<<<<<<<<<<<
 * 
 *     def get_leaves(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __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;

  /* "mathics/core/expression.py":330
 *         return None
 * 
 *     def get_head_name(self):             # <<<<<<<<<<<<<<
 *         return self.get_head().get_name()
 * 
 */

  /* 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("mathics.core.expression.BaseExpression.get_head_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":333
 *         return self.get_head().get_name()
 * 
 *     def get_leaves(self):             # <<<<<<<<<<<<<<
 *         return []
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_35get_leaves(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_35get_leaves = {"get_leaves", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_35get_leaves, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_35get_leaves(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_leaves (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_34get_leaves(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":334
 * 
 *     def get_leaves(self):
 *         return []             # <<<<<<<<<<<<<<
 * 
 *     def get_int_value(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":333
 *         return self.get_head().get_name()
 * 
 *     def get_leaves(self):             # <<<<<<<<<<<<<<
 *         return []
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.get_leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":336
 *         return []
 * 
 *     def get_int_value(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_37get_int_value(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_37get_int_value = {"get_int_value", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_37get_int_value, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_37get_int_value(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_int_value (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_36get_int_value(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_36get_int_value(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_int_value", 0);

  /* "mathics/core/expression.py":337
 * 
 *     def get_int_value(self):
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def get_float_value(self, permit_complex=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":336
 *         return []
 * 
 *     def get_int_value(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "mathics/core/expression.py":339
 *         return None
 * 
 *     def get_float_value(self, permit_complex=False):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_39get_float_value(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_39get_float_value = {"get_float_value", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_39get_float_value, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_39get_float_value(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_permit_complex = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_float_value (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_permit_complex,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_permit_complex);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_float_value") < 0)) __PYX_ERR(0, 339, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_permit_complex = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_float_value", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 339, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.get_float_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_38get_float_value(__pyx_self, __pyx_v_self, __pyx_v_permit_complex);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_38get_float_value(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_permit_complex) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_float_value", 0);

  /* "mathics/core/expression.py":340
 * 
 *     def get_float_value(self, permit_complex=False):
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def get_string_value(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":339
 *         return None
 * 
 *     def get_float_value(self, permit_complex=False):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "mathics/core/expression.py":342
 *         return None
 * 
 *     def get_string_value(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_41get_string_value(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_41get_string_value = {"get_string_value", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_41get_string_value, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_41get_string_value(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_string_value (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_40get_string_value(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_40get_string_value(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_string_value", 0);

  /* "mathics/core/expression.py":343
 * 
 *     def get_string_value(self):
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def is_atom(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":342
 *         return None
 * 
 *     def get_string_value(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "mathics/core/expression.py":345
 *         return None
 * 
 *     def is_atom(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_43is_atom(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_43is_atom = {"is_atom", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_43is_atom, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_43is_atom(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_atom (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_42is_atom(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_42is_atom(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_atom", 0);

  /* "mathics/core/expression.py":346
 * 
 *     def is_atom(self) -> bool:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def is_true(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":345
 *         return None
 * 
 *     def is_atom(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

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

/* "mathics/core/expression.py":348
 *         return False
 * 
 *     def is_true(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_45is_true(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_45is_true = {"is_true", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_45is_true, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_45is_true(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_true (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_44is_true(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_44is_true(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_true", 0);

  /* "mathics/core/expression.py":349
 * 
 *     def is_true(self) -> bool:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def is_numeric(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":348
 *         return False
 * 
 *     def is_true(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

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

/* "mathics/core/expression.py":351
 *         return False
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         # used by NumericQ and expression ordering
 *         return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_47is_numeric(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_47is_numeric = {"is_numeric", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_47is_numeric, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_47is_numeric(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_numeric (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_46is_numeric(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_46is_numeric(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_numeric", 0);

  /* "mathics/core/expression.py":353
 *     def is_numeric(self) -> bool:
 *         # used by NumericQ and expression ordering
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def has_form(self, heads, *leaf_counts):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":351
 *         return False
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         # used by NumericQ and expression ordering
 *         return False
 */

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

/* "mathics/core/expression.py":355
 *         return False
 * 
 *     def has_form(self, heads, *leaf_counts):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_49has_form(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_49has_form = {"has_form", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_49has_form, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_49has_form(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_heads = 0;
  CYTHON_UNUSED PyObject *__pyx_v_leaf_counts = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_form (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_leaf_counts = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_leaf_counts)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_leaf_counts);
  } else {
    __pyx_v_leaf_counts = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_heads,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_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_heads)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("has_form", 0, 2, 2, 1); __PYX_ERR(0, 355, __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, 0, values, used_pos_args, "has_form") < 0)) __PYX_ERR(0, 355, __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_heads = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_form", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 355, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_leaf_counts); __pyx_v_leaf_counts = 0;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.has_form", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_48has_form(__pyx_self, __pyx_v_self, __pyx_v_heads, __pyx_v_leaf_counts);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_48has_form(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_heads, CYTHON_UNUSED PyObject *__pyx_v_leaf_counts) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_form", 0);

  /* "mathics/core/expression.py":356
 * 
 *     def has_form(self, heads, *leaf_counts):
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def flatten(self, head, pattern_only=False, callback=None) -> "BaseExpression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":355
 *         return False
 * 
 *     def has_form(self, heads, *leaf_counts):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

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

/* "mathics/core/expression.py":358
 *         return False
 * 
 *     def flatten(self, head, pattern_only=False, callback=None) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_51flatten(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_51flatten = {"flatten", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_51flatten, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_51flatten(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_head = 0;
  CYTHON_UNUSED PyObject *__pyx_v_pattern_only = 0;
  CYTHON_UNUSED PyObject *__pyx_v_callback = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flatten (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_head,&__pyx_n_s_pattern_only,&__pyx_n_s_callback,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_False));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_head)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("flatten", 0, 2, 4, 1); __PYX_ERR(0, 358, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_only);
          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_callback);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flatten") < 0)) __PYX_ERR(0, 358, __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_self = values[0];
    __pyx_v_head = values[1];
    __pyx_v_pattern_only = values[2];
    __pyx_v_callback = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("flatten", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 358, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.flatten", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_50flatten(__pyx_self, __pyx_v_self, __pyx_v_head, __pyx_v_pattern_only, __pyx_v_callback);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_50flatten(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_head, CYTHON_UNUSED PyObject *__pyx_v_pattern_only, CYTHON_UNUSED PyObject *__pyx_v_callback) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flatten", 0);

  /* "mathics/core/expression.py":359
 * 
 *     def flatten(self, head, pattern_only=False, callback=None) -> "BaseExpression":
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":358
 *         return False
 * 
 *     def flatten(self, head, pattern_only=False, callback=None) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "mathics/core/expression.py":361
 *         return self
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         """
 *         To allow usage of expression as dictionary keys,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_53__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_14BaseExpression_52__hash__[] = "\n        To allow usage of expression as dictionary keys,\n        as in Expression.get_pre_choices\n        ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_53__hash__ = {"__hash__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_53__hash__, METH_O, __pyx_doc_7mathics_4core_10expression_14BaseExpression_52__hash__};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_53__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_52__hash__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":366
 *         as in Expression.get_pre_choices
 *         """
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def user_hash(self, update) -> None:
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 366, __pyx_L1_error)

  /* "mathics/core/expression.py":361
 *         return self
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         """
 *         To allow usage of expression as dictionary keys,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":368
 *         raise NotImplementedError
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         # whereas __hash__ is for internal Mathics purposes like using Expressions as dictionary keys and fast
 *         # comparison of elements, user_hash is called for Hash[]. user_hash should strive to give stable results
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_55user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_55user_hash = {"user_hash", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_55user_hash, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_55user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_update = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("user_hash (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_update,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_update)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, 1); __PYX_ERR(0, 368, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "user_hash") < 0)) __PYX_ERR(0, 368, __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_update = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 368, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_54user_hash(__pyx_self, __pyx_v_self, __pyx_v_update);

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

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

  /* "mathics/core/expression.py":373
 *         # across versions, whereas __hash__ must not. user_hash should try to hash all the data available, whereas
 *         # __hash__ might only hash a sample of the data available.
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def sameQ(self, rhs) -> bool:
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 373, __pyx_L1_error)

  /* "mathics/core/expression.py":368
 *         raise NotImplementedError
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         # whereas __hash__ is for internal Mathics purposes like using Expressions as dictionary keys and fast
 *         # comparison of elements, user_hash is called for Hash[]. user_hash should strive to give stable results
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":375
 *         raise NotImplementedError
 * 
 *     def sameQ(self, rhs) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return id(self) == id(rhs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_57sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_14BaseExpression_56sameQ[] = "Mathics SameQ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_57sameQ = {"sameQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_57sameQ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_14BaseExpression_56sameQ};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_57sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_rhs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sameQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rhs,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_rhs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, 1); __PYX_ERR(0, 375, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sameQ") < 0)) __PYX_ERR(0, 375, __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_rhs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 375, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_56sameQ(__pyx_self, __pyx_v_self, __pyx_v_rhs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_56sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) {
  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("sameQ", 0);

  /* "mathics/core/expression.py":377
 *     def sameQ(self, rhs) -> bool:
 *         """Mathics SameQ"""
 *         return id(self) == id(rhs)             # <<<<<<<<<<<<<<
 * 
 *     def get_sequence(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_rhs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":375
 *         raise NotImplementedError
 * 
 *     def sameQ(self, rhs) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return id(self) == id(rhs)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":379
 *         return id(self) == id(rhs)
 * 
 *     def get_sequence(self):             # <<<<<<<<<<<<<<
 *         if self.get_head().get_name() == "System`Sequence":
 *             return self.leaves
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_59get_sequence(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_59get_sequence = {"get_sequence", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_59get_sequence, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_59get_sequence(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sequence (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_58get_sequence(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":380
 * 
 *     def get_sequence(self):
 *         if self.get_head().get_name() == "System`Sequence":             # <<<<<<<<<<<<<<
 *             return self.leaves
 *         else:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_Sequence, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":381
 *     def get_sequence(self):
 *         if self.get_head().get_name() == "System`Sequence":
 *             return self.leaves             # <<<<<<<<<<<<<<
 *         else:
 *             return [self]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves); 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;

    /* "mathics/core/expression.py":380
 * 
 *     def get_sequence(self):
 *         if self.get_head().get_name() == "System`Sequence":             # <<<<<<<<<<<<<<
 *             return self.leaves
 *         else:
 */
  }

  /* "mathics/core/expression.py":383
 *             return self.leaves
 *         else:
 *             return [self]             # <<<<<<<<<<<<<<
 * 
 *     def evaluate_leaves(self, evaluation) -> "BaseExpression":
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":379
 *         return id(self) == id(rhs)
 * 
 *     def get_sequence(self):             # <<<<<<<<<<<<<<
 *         if self.get_head().get_name() == "System`Sequence":
 *             return self.leaves
 */

  /* 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("mathics.core.expression.BaseExpression.get_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":385
 *             return [self]
 * 
 *     def evaluate_leaves(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_61evaluate_leaves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_61evaluate_leaves = {"evaluate_leaves", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_61evaluate_leaves, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_61evaluate_leaves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_leaves (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_leaves", 1, 2, 2, 1); __PYX_ERR(0, 385, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate_leaves") < 0)) __PYX_ERR(0, 385, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate_leaves", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 385, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.evaluate_leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_60evaluate_leaves(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_60evaluate_leaves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_leaves", 0);

  /* "mathics/core/expression.py":386
 * 
 *     def evaluate_leaves(self, evaluation) -> "BaseExpression":
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def apply_rules(
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":385
 *             return [self]
 * 
 *     def evaluate_leaves(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "mathics/core/expression.py":388
 *         return self
 * 
 *     def apply_rules(             # <<<<<<<<<<<<<<
 *         self, rules, evaluation, level=0, options=None
 *     ) -> typing.Tuple["BaseExpression", bool]:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_63apply_rules(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_63apply_rules = {"apply_rules", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_63apply_rules, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_63apply_rules(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_rules = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_rules (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rules,&__pyx_n_s_evaluation,&__pyx_n_s_level,&__pyx_n_s_options,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)__pyx_int_0));

    /* "mathics/core/expression.py":389
 * 
 *     def apply_rules(
 *         self, rules, evaluation, level=0, options=None             # <<<<<<<<<<<<<<
 *     ) -> typing.Tuple["BaseExpression", bool]:
 *         if options:
 */
    values[4] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rules)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_rules", 0, 3, 5, 1); __PYX_ERR(0, 388, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_rules", 0, 3, 5, 2); __PYX_ERR(0, 388, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level);
          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_options);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_rules") < 0)) __PYX_ERR(0, 388, __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_self = values[0];
    __pyx_v_rules = values[1];
    __pyx_v_evaluation = values[2];
    __pyx_v_level = values[3];
    __pyx_v_options = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_rules", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 388, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.apply_rules", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_62apply_rules(__pyx_self, __pyx_v_self, __pyx_v_rules, __pyx_v_evaluation, __pyx_v_level, __pyx_v_options);

  /* "mathics/core/expression.py":388
 *         return self
 * 
 *     def apply_rules(             # <<<<<<<<<<<<<<
 *         self, rules, evaluation, level=0, options=None
 *     ) -> typing.Tuple["BaseExpression", bool]:
 */

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_62apply_rules(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rules, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_level, PyObject *__pyx_v_options) {
  PyObject *__pyx_v_l1 = NULL;
  PyObject *__pyx_v_l2 = NULL;
  PyObject *__pyx_v_rule = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_rules", 0);

  /* "mathics/core/expression.py":391
 *         self, rules, evaluation, level=0, options=None
 *     ) -> typing.Tuple["BaseExpression", bool]:
 *         if options:             # <<<<<<<<<<<<<<
 *             l1, l2 = options["levelspec"]
 *             if level < l1:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_options); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 391, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":392
 *     ) -> typing.Tuple["BaseExpression", bool]:
 *         if options:
 *             l1, l2 = options["levelspec"]             # <<<<<<<<<<<<<<
 *             if level < l1:
 *                 return self, False
 */
    __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_options, __pyx_n_u_levelspec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 392, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 392, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 392, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_l1 = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_l2 = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":393
 *         if options:
 *             l1, l2 = options["levelspec"]
 *             if level < l1:             # <<<<<<<<<<<<<<
 *                 return self, False
 *             elif l2 is not None and level > l2:
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_level, __pyx_v_l1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 393, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":394
 *             l1, l2 = options["levelspec"]
 *             if level < l1:
 *                 return self, False             # <<<<<<<<<<<<<<
 *             elif l2 is not None and level > l2:
 *                 return self, False
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 394, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
      __Pyx_INCREF(Py_False);
      __Pyx_GIVEREF(Py_False);
      PyTuple_SET_ITEM(__pyx_t_2, 1, Py_False);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":393
 *         if options:
 *             l1, l2 = options["levelspec"]
 *             if level < l1:             # <<<<<<<<<<<<<<
 *                 return self, False
 *             elif l2 is not None and level > l2:
 */
    }

    /* "mathics/core/expression.py":395
 *             if level < l1:
 *                 return self, False
 *             elif l2 is not None and level > l2:             # <<<<<<<<<<<<<<
 *                 return self, False
 * 
 */
    __pyx_t_7 = (__pyx_v_l2 != Py_None);
    __pyx_t_8 = (__pyx_t_7 != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_1 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_level, __pyx_v_l2, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 395, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_8;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":396
 *                 return self, False
 *             elif l2 is not None and level > l2:
 *                 return self, False             # <<<<<<<<<<<<<<
 * 
 *         for rule in rules:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
      __Pyx_INCREF(Py_False);
      __Pyx_GIVEREF(Py_False);
      PyTuple_SET_ITEM(__pyx_t_2, 1, Py_False);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":395
 *             if level < l1:
 *                 return self, False
 *             elif l2 is not None and level > l2:             # <<<<<<<<<<<<<<
 *                 return self, False
 * 
 */
    }

    /* "mathics/core/expression.py":391
 *         self, rules, evaluation, level=0, options=None
 *     ) -> typing.Tuple["BaseExpression", bool]:
 *         if options:             # <<<<<<<<<<<<<<
 *             l1, l2 = options["levelspec"]
 *             if level < l1:
 */
  }

  /* "mathics/core/expression.py":398
 *                 return self, False
 * 
 *         for rule in rules:             # <<<<<<<<<<<<<<
 *             result = rule.apply(self, evaluation, fully=False)
 *             if result is not None:
 */
  if (likely(PyList_CheckExact(__pyx_v_rules)) || PyTuple_CheckExact(__pyx_v_rules)) {
    __pyx_t_2 = __pyx_v_rules; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_rules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 398, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 398, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 398, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_10(__pyx_t_2);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 398, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_rule, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":399
 * 
 *         for rule in rules:
 *             result = rule.apply(self, evaluation, fully=False)             # <<<<<<<<<<<<<<
 *             if result is not None:
 *                 return result, True
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_rule, __pyx_n_s_apply); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_evaluation);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_fully, Py_False) < 0) __PYX_ERR(0, 399, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __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;
    __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "mathics/core/expression.py":400
 *         for rule in rules:
 *             result = rule.apply(self, evaluation, fully=False)
 *             if result is not None:             # <<<<<<<<<<<<<<
 *                 return result, True
 *         return self, False
 */
    __pyx_t_1 = (__pyx_v_result != Py_None);
    __pyx_t_8 = (__pyx_t_1 != 0);
    if (__pyx_t_8) {

      /* "mathics/core/expression.py":401
 *             result = rule.apply(self, evaluation, fully=False)
 *             if result is not None:
 *                 return result, True             # <<<<<<<<<<<<<<
 *         return self, False
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 401, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_v_result);
      __Pyx_GIVEREF(__pyx_v_result);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_result);
      __Pyx_INCREF(Py_True);
      __Pyx_GIVEREF(Py_True);
      PyTuple_SET_ITEM(__pyx_t_11, 1, Py_True);
      __pyx_r = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":400
 *         for rule in rules:
 *             result = rule.apply(self, evaluation, fully=False)
 *             if result is not None:             # <<<<<<<<<<<<<<
 *                 return result, True
 *         return self, False
 */
    }

    /* "mathics/core/expression.py":398
 *                 return self, False
 * 
 *         for rule in rules:             # <<<<<<<<<<<<<<
 *             result = rule.apply(self, evaluation, fully=False)
 *             if result is not None:
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":402
 *             if result is not None:
 *                 return result, True
 *         return self, False             # <<<<<<<<<<<<<<
 * 
 *     def do_format(self, evaluation, form):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_False);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":388
 *         return self
 * 
 *     def apply_rules(             # <<<<<<<<<<<<<<
 *         self, rules, evaluation, level=0, options=None
 *     ) -> typing.Tuple["BaseExpression", bool]:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.apply_rules", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_l1);
  __Pyx_XDECREF(__pyx_v_l2);
  __Pyx_XDECREF(__pyx_v_rule);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":404
 *         return self, False
 * 
 *     def do_format(self, evaluation, form):             # <<<<<<<<<<<<<<
 *         """
 *         Applies formats associated to the expression and removes
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_65do_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_14BaseExpression_64do_format[] = "\n        Applies formats associated to the expression and removes\n        superfluous enclosing formats.\n        ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_65do_format = {"do_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_65do_format, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_14BaseExpression_64do_format};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_65do_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, 1); __PYX_ERR(0, 404, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, 2); __PYX_ERR(0, 404, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "do_format") < 0)) __PYX_ERR(0, 404, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 404, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.do_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_64do_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

/* "mathics/core/expression.py":472
 *             # If expr is not an atom, looks for formats in its definition
 *             # and apply them.
 *             def format_expr(expr):             # <<<<<<<<<<<<<<
 *                 if not (expr.is_atom()) and not (expr.head.is_atom()):
 *                     # expr is of the form f[...][...]
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_9do_format_1format_expr(PyObject *__pyx_self, PyObject *__pyx_v_expr); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_9do_format_1format_expr = {"format_expr", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_9do_format_1format_expr, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_9do_format_1format_expr(PyObject *__pyx_self, PyObject *__pyx_v_expr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("format_expr (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_9do_format_format_expr(__pyx_self, ((PyObject *)__pyx_v_expr));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_9do_format_format_expr(PyObject *__pyx_self, PyObject *__pyx_v_expr) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *__pyx_cur_scope;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *__pyx_outer_scope;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_formats = NULL;
  PyObject *__pyx_v_rule = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("format_expr", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/core/expression.py":473
 *             # and apply them.
 *             def format_expr(expr):
 *                 if not (expr.is_atom()) and not (expr.head.is_atom()):             # <<<<<<<<<<<<<<
 *                     # expr is of the form f[...][...]
 *                     return None
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_is_atom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 473, __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 < 0)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_head); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_is_atom); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = ((!__pyx_t_6) != 0);
  __pyx_t_1 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":475
 *                 if not (expr.is_atom()) and not (expr.head.is_atom()):
 *                     # expr is of the form f[...][...]
 *                     return None             # <<<<<<<<<<<<<<
 *                 name = expr.get_lookup_name()
 *                 formats = evaluation.definitions.get_formats(name, form)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/core/expression.py":473
 *             # and apply them.
 *             def format_expr(expr):
 *                 if not (expr.is_atom()) and not (expr.head.is_atom()):             # <<<<<<<<<<<<<<
 *                     # expr is of the form f[...][...]
 *                     return None
 */
  }

  /* "mathics/core/expression.py":476
 *                     # expr is of the form f[...][...]
 *                     return None
 *                 name = expr.get_lookup_name()             # <<<<<<<<<<<<<<
 *                 formats = evaluation.definitions.get_formats(name, form)
 *                 for rule in formats:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_get_lookup_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_name = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":477
 *                     return None
 *                 name = expr.get_lookup_name()
 *                 formats = evaluation.definitions.get_formats(name, form)             # <<<<<<<<<<<<<<
 *                 for rule in formats:
 *                     result = rule.apply(expr, evaluation)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 477, __pyx_L1_error) }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_formats); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_form)) { __Pyx_RaiseClosureNameError("form"); __PYX_ERR(0, 477, __pyx_L1_error) }
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_name, __pyx_cur_scope->__pyx_v_form};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __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_name, __pyx_cur_scope->__pyx_v_form};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 477, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_name);
    __Pyx_GIVEREF(__pyx_v_name);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_name);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_form);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_form);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_cur_scope->__pyx_v_form);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_formats = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":478
 *                 name = expr.get_lookup_name()
 *                 formats = evaluation.definitions.get_formats(name, form)
 *                 for rule in formats:             # <<<<<<<<<<<<<<
 *                     result = rule.apply(expr, evaluation)
 *                     if result is not None and result != expr:
 */
  if (likely(PyList_CheckExact(__pyx_v_formats)) || PyTuple_CheckExact(__pyx_v_formats)) {
    __pyx_t_2 = __pyx_v_formats; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_formats); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 478, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 478, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 478, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 478, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 478, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_10(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 478, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_rule, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":479
 *                 formats = evaluation.definitions.get_formats(name, form)
 *                 for rule in formats:
 *                     result = rule.apply(expr, evaluation)             # <<<<<<<<<<<<<<
 *                     if result is not None and result != expr:
 *                         return result.evaluate(evaluation)
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_rule, __pyx_n_s_apply); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (unlikely(!__pyx_cur_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 479, __pyx_L1_error) }
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_expr, __pyx_cur_scope->__pyx_v_evaluation};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_expr, __pyx_cur_scope->__pyx_v_evaluation};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_expr);
      __Pyx_GIVEREF(__pyx_v_expr);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_7, __pyx_v_expr);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_7, __pyx_cur_scope->__pyx_v_evaluation);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 479, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":480
 *                 for rule in formats:
 *                     result = rule.apply(expr, evaluation)
 *                     if result is not None and result != expr:             # <<<<<<<<<<<<<<
 *                         return result.evaluate(evaluation)
 *                 return None
 */
    __pyx_t_5 = (__pyx_v_result != Py_None);
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_result, __pyx_v_expr, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 480, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __pyx_t_6;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":481
 *                     result = rule.apply(expr, evaluation)
 *                     if result is not None and result != expr:
 *                         return result.evaluate(evaluation)             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (unlikely(!__pyx_cur_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 481, __pyx_L1_error) }
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_3 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_11, __pyx_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_cur_scope->__pyx_v_evaluation);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":480
 *                 for rule in formats:
 *                     result = rule.apply(expr, evaluation)
 *                     if result is not None and result != expr:             # <<<<<<<<<<<<<<
 *                         return result.evaluate(evaluation)
 *                 return None
 */
    }

    /* "mathics/core/expression.py":478
 *                 name = expr.get_lookup_name()
 *                 formats = evaluation.definitions.get_formats(name, form)
 *                 for rule in formats:             # <<<<<<<<<<<<<<
 *                     result = rule.apply(expr, evaluation)
 *                     if result is not None and result != expr:
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":482
 *                     if result is not None and result != expr:
 *                         return result.evaluate(evaluation)
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *             formatted = format_expr(expr)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":472
 *             # If expr is not an atom, looks for formats in its definition
 *             # and apply them.
 *             def format_expr(expr):             # <<<<<<<<<<<<<<
 *                 if not (expr.is_atom()) and not (expr.head.is_atom()):
 *                     # expr is of the form f[...][...]
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.do_format.format_expr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_formats);
  __Pyx_XDECREF(__pyx_v_rule);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":404
 *         return self, False
 * 
 *     def do_format(self, evaluation, form):             # <<<<<<<<<<<<<<
 *         """
 *         Applies formats associated to the expression and removes
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_64do_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *__pyx_cur_scope;
  PyObject *__pyx_v_formats = NULL;
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_v_head = NULL;
  PyObject *__pyx_v_leaves = NULL;
  int __pyx_v_include_form;
  PyObject *__pyx_v_unformatted = NULL;
  PyObject *__pyx_v_format_expr = 0;
  PyObject *__pyx_v_formatted = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_new_leaves = NULL;
  PyObject *__pyx_8genexpr6__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  int __pyx_t_16;
  char const *__pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("do_format", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_2_do_format(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_2_do_format, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 404, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_evaluation = __pyx_v_evaluation;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
  __pyx_cur_scope->__pyx_v_form = __pyx_v_form;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_form);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_form);

  /* "mathics/core/expression.py":409
 *         superfluous enclosing formats.
 *         """
 *         formats = system_symbols(             # <<<<<<<<<<<<<<
 *             "InputForm",
 *             "OutputForm",
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_system_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_formats = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":419
 *         )
 * 
 *         evaluation.inc_recursion_depth()             # <<<<<<<<<<<<<<
 *         try:
 *             expr = self
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_evaluation, __pyx_n_s_inc_recursion_depth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":420
 * 
 *         evaluation.inc_recursion_depth()
 *         try:             # <<<<<<<<<<<<<<
 *             expr = self
 *             head = self.get_head_name()
 */
  /*try:*/ {

    /* "mathics/core/expression.py":421
 *         evaluation.inc_recursion_depth()
 *         try:
 *             expr = self             # <<<<<<<<<<<<<<
 *             head = self.get_head_name()
 *             leaves = self.get_leaves()
 */
    __Pyx_INCREF(__pyx_v_self);
    __pyx_v_expr = __pyx_v_self;

    /* "mathics/core/expression.py":422
 *         try:
 *             expr = self
 *             head = self.get_head_name()             # <<<<<<<<<<<<<<
 *             leaves = self.get_leaves()
 *             include_form = False
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_head = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":423
 *             expr = self
 *             head = self.get_head_name()
 *             leaves = self.get_leaves()             # <<<<<<<<<<<<<<
 *             include_form = False
 *             # If the expression is enclosed by a Format
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_leaves = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":424
 *             head = self.get_head_name()
 *             leaves = self.get_leaves()
 *             include_form = False             # <<<<<<<<<<<<<<
 *             # If the expression is enclosed by a Format
 *             # takes the form from the expression and
 */
    __pyx_v_include_form = 0;

    /* "mathics/core/expression.py":428
 *             # takes the form from the expression and
 *             # removes the format from the expression.
 *             if head in formats and len(leaves) == 1:             # <<<<<<<<<<<<<<
 *                 expr = leaves[0]
 *                 if not (form == "System`OutputForm" and head == "System`StandardForm"):
 */
    __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_head, __pyx_v_formats, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 428, __pyx_L4_error)
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_4 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_7 = PyObject_Length(__pyx_v_leaves); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 428, __pyx_L4_error)
    __pyx_t_6 = ((__pyx_t_7 == 1) != 0);
    __pyx_t_4 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":429
 *             # removes the format from the expression.
 *             if head in formats and len(leaves) == 1:
 *                 expr = leaves[0]             # <<<<<<<<<<<<<<
 *                 if not (form == "System`OutputForm" and head == "System`StandardForm"):
 *                     form = head
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_leaves, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":430
 *             if head in formats and len(leaves) == 1:
 *                 expr = leaves[0]
 *                 if not (form == "System`OutputForm" and head == "System`StandardForm"):             # <<<<<<<<<<<<<<
 *                     form = head
 *                     include_form = True
 */
      __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_form, __pyx_kp_u_System_OutputForm, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 430, __pyx_L4_error)
      if (__pyx_t_6) {
      } else {
        __pyx_t_4 = __pyx_t_6;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_head, __pyx_kp_u_System_StandardForm, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 430, __pyx_L4_error)
      __pyx_t_4 = __pyx_t_6;
      __pyx_L10_bool_binop_done:;
      __pyx_t_6 = ((!__pyx_t_4) != 0);
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":431
 *                 expr = leaves[0]
 *                 if not (form == "System`OutputForm" and head == "System`StandardForm"):
 *                     form = head             # <<<<<<<<<<<<<<
 *                     include_form = True
 *             unformatted = expr
 */
        __Pyx_INCREF(__pyx_v_head);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_form);
        __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_form, __pyx_v_head);
        __Pyx_GIVEREF(__pyx_v_head);

        /* "mathics/core/expression.py":432
 *                 if not (form == "System`OutputForm" and head == "System`StandardForm"):
 *                     form = head
 *                     include_form = True             # <<<<<<<<<<<<<<
 *             unformatted = expr
 *             # If form is Fullform, return it without changes
 */
        __pyx_v_include_form = 1;

        /* "mathics/core/expression.py":430
 *             if head in formats and len(leaves) == 1:
 *                 expr = leaves[0]
 *                 if not (form == "System`OutputForm" and head == "System`StandardForm"):             # <<<<<<<<<<<<<<
 *                     form = head
 *                     include_form = True
 */
      }

      /* "mathics/core/expression.py":428
 *             # takes the form from the expression and
 *             # removes the format from the expression.
 *             if head in formats and len(leaves) == 1:             # <<<<<<<<<<<<<<
 *                 expr = leaves[0]
 *                 if not (form == "System`OutputForm" and head == "System`StandardForm"):
 */
    }

    /* "mathics/core/expression.py":433
 *                     form = head
 *                     include_form = True
 *             unformatted = expr             # <<<<<<<<<<<<<<
 *             # If form is Fullform, return it without changes
 *             if form == "System`FullForm":
 */
    __Pyx_INCREF(__pyx_v_expr);
    __pyx_v_unformatted = __pyx_v_expr;

    /* "mathics/core/expression.py":435
 *             unformatted = expr
 *             # If form is Fullform, return it without changes
 *             if form == "System`FullForm":             # <<<<<<<<<<<<<<
 *                 if include_form:
 *                     expr = Expression(form, expr)
 */
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_form, __pyx_kp_u_System_FullForm, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 435, __pyx_L4_error)
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":436
 *             # If form is Fullform, return it without changes
 *             if form == "System`FullForm":
 *                 if include_form:             # <<<<<<<<<<<<<<
 *                     expr = Expression(form, expr)
 *                     expr.unformatted = unformatted
 */
      __pyx_t_6 = (__pyx_v_include_form != 0);
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":437
 *             if form == "System`FullForm":
 *                 if include_form:
 *                     expr = Expression(form, expr)             # <<<<<<<<<<<<<<
 *                     expr.unformatted = unformatted
 *                 return expr
 */
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = NULL;
        __pyx_t_8 = 0;
        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_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_form, __pyx_v_expr};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_form, __pyx_v_expr};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 437, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (__pyx_t_3) {
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL;
          }
          __Pyx_INCREF(__pyx_cur_scope->__pyx_v_form);
          __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_form);
          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_form);
          __Pyx_INCREF(__pyx_v_expr);
          __Pyx_GIVEREF(__pyx_v_expr);
          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_expr);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":438
 *                 if include_form:
 *                     expr = Expression(form, expr)
 *                     expr.unformatted = unformatted             # <<<<<<<<<<<<<<
 *                 return expr
 * 
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_unformatted, __pyx_v_unformatted) < 0) __PYX_ERR(0, 438, __pyx_L4_error)

        /* "mathics/core/expression.py":436
 *             # If form is Fullform, return it without changes
 *             if form == "System`FullForm":
 *                 if include_form:             # <<<<<<<<<<<<<<
 *                     expr = Expression(form, expr)
 *                     expr.unformatted = unformatted
 */
      }

      /* "mathics/core/expression.py":439
 *                     expr = Expression(form, expr)
 *                     expr.unformatted = unformatted
 *                 return expr             # <<<<<<<<<<<<<<
 * 
 *             # Repeated and RepeatedNull confuse the formatter,
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_expr);
      __pyx_r = __pyx_v_expr;
      goto __pyx_L3_return;

      /* "mathics/core/expression.py":435
 *             unformatted = expr
 *             # If form is Fullform, return it without changes
 *             if form == "System`FullForm":             # <<<<<<<<<<<<<<
 *                 if include_form:
 *                     expr = Expression(form, expr)
 */
    }

    /* "mathics/core/expression.py":443
 *             # Repeated and RepeatedNull confuse the formatter,
 *             # so we need to hardlink their format rules:
 *             if head == "System`Repeated":             # <<<<<<<<<<<<<<
 *                 if len(leaves) == 1:
 *                     return Expression(
 */
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_head, __pyx_kp_u_System_Repeated, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 443, __pyx_L4_error)
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":444
 *             # so we need to hardlink their format rules:
 *             if head == "System`Repeated":
 *                 if len(leaves) == 1:             # <<<<<<<<<<<<<<
 *                     return Expression(
 *                         "System`HoldForm",
 */
      __pyx_t_7 = PyObject_Length(__pyx_v_leaves); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 444, __pyx_L4_error)
      __pyx_t_6 = ((__pyx_t_7 == 1) != 0);
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":445
 *             if head == "System`Repeated":
 *                 if len(leaves) == 1:
 *                     return Expression(             # <<<<<<<<<<<<<<
 *                         "System`HoldForm",
 *                         Expression(
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);

        /* "mathics/core/expression.py":447
 *                     return Expression(
 *                         "System`HoldForm",
 *                         Expression(             # <<<<<<<<<<<<<<
 *                             "System`Postfix",
 *                             Expression("System`List", leaves[0]),
 */
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_3);

        /* "mathics/core/expression.py":449
 *                         Expression(
 *                             "System`Postfix",
 *                             Expression("System`List", leaves[0]),             # <<<<<<<<<<<<<<
 *                             "..",
 *                             170,
 */
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_Expression); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 449, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_leaves, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 449, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
            __pyx_t_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_u_System_List, __pyx_t_12};
          __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 449, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_u_System_List, __pyx_t_12};
          __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 449, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        {
          __pyx_t_14 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 449, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_14);
          if (__pyx_t_13) {
            __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_u_System_List);
          __Pyx_GIVEREF(__pyx_kp_u_System_List);
          PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_8, __pyx_kp_u_System_List);
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_8, __pyx_t_12);
          __pyx_t_12 = 0;
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_14, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 449, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_kp_u_System_Postfix, __pyx_t_10, __pyx_kp_u__7, __pyx_int_170};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 447, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_kp_u_System_Postfix, __pyx_t_10, __pyx_kp_u__7, __pyx_int_170};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 447, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        {
          __pyx_t_14 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 447, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_14);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11); __pyx_t_11 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_u_System_Postfix);
          __Pyx_GIVEREF(__pyx_kp_u_System_Postfix);
          PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_8, __pyx_kp_u_System_Postfix);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_8, __pyx_t_10);
          __Pyx_INCREF(__pyx_kp_u__7);
          __Pyx_GIVEREF(__pyx_kp_u__7);
          PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_8, __pyx_kp_u__7);
          __Pyx_INCREF(__pyx_int_170);
          __Pyx_GIVEREF(__pyx_int_170);
          PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_8, __pyx_int_170);
          __pyx_t_10 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_14, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 447, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = NULL;
        __pyx_t_8 = 0;
        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_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_System_HoldForm, __pyx_t_9};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_u_System_HoldForm, __pyx_t_9};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else
        #endif
        {
          __pyx_t_14 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 445, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_14);
          if (__pyx_t_3) {
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3); __pyx_t_3 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_u_System_HoldForm);
          __Pyx_GIVEREF(__pyx_kp_u_System_HoldForm);
          PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_8, __pyx_kp_u_System_HoldForm);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_8, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L3_return;

        /* "mathics/core/expression.py":444
 *             # so we need to hardlink their format rules:
 *             if head == "System`Repeated":
 *                 if len(leaves) == 1:             # <<<<<<<<<<<<<<
 *                     return Expression(
 *                         "System`HoldForm",
 */
      }

      /* "mathics/core/expression.py":455
 *                     )
 *                 else:
 *                     return Expression("System`HoldForm", expr)             # <<<<<<<<<<<<<<
 *             elif head == "System`RepeatedNull":
 *                 if len(leaves) == 1:
 */
      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_14 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_kp_u_System_HoldForm, __pyx_v_expr};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_kp_u_System_HoldForm, __pyx_v_expr};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 455, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (__pyx_t_14) {
            __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_14); __pyx_t_14 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_u_System_HoldForm);
          __Pyx_GIVEREF(__pyx_kp_u_System_HoldForm);
          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_u_System_HoldForm);
          __Pyx_INCREF(__pyx_v_expr);
          __Pyx_GIVEREF(__pyx_v_expr);
          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_expr);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L3_return;
      }

      /* "mathics/core/expression.py":443
 *             # Repeated and RepeatedNull confuse the formatter,
 *             # so we need to hardlink their format rules:
 *             if head == "System`Repeated":             # <<<<<<<<<<<<<<
 *                 if len(leaves) == 1:
 *                     return Expression(
 */
    }

    /* "mathics/core/expression.py":456
 *                 else:
 *                     return Expression("System`HoldForm", expr)
 *             elif head == "System`RepeatedNull":             # <<<<<<<<<<<<<<
 *                 if len(leaves) == 1:
 *                     return Expression(
 */
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_head, __pyx_kp_u_System_RepeatedNull, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 456, __pyx_L4_error)
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":457
 *                     return Expression("System`HoldForm", expr)
 *             elif head == "System`RepeatedNull":
 *                 if len(leaves) == 1:             # <<<<<<<<<<<<<<
 *                     return Expression(
 *                         "System`HoldForm",
 */
      __pyx_t_7 = PyObject_Length(__pyx_v_leaves); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 457, __pyx_L4_error)
      __pyx_t_6 = ((__pyx_t_7 == 1) != 0);
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":458
 *             elif head == "System`RepeatedNull":
 *                 if len(leaves) == 1:
 *                     return Expression(             # <<<<<<<<<<<<<<
 *                         "System`HoldForm",
 *                         Expression(
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);

        /* "mathics/core/expression.py":460
 *                     return Expression(
 *                         "System`HoldForm",
 *                         Expression(             # <<<<<<<<<<<<<<
 *                             "System`Postfix",
 *                             Expression("System`List", leaves[0]),
 */
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_Expression); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 460, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_14);

        /* "mathics/core/expression.py":462
 *                         Expression(
 *                             "System`Postfix",
 *                             Expression("System`List", leaves[0]),             # <<<<<<<<<<<<<<
 *                             "...",
 *                             170,
 */
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_Expression); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 462, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_leaves, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 462, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
            __pyx_t_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_kp_u_System_List, __pyx_t_11};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_kp_u_System_List, __pyx_t_11};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        } else
        #endif
        {
          __pyx_t_13 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 462, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (__pyx_t_12) {
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_u_System_List);
          __Pyx_GIVEREF(__pyx_kp_u_System_List);
          PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_8, __pyx_kp_u_System_List);
          __Pyx_GIVEREF(__pyx_t_11);
          PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_8, __pyx_t_11);
          __pyx_t_11 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 462, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
            __pyx_t_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_14)) {
          PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_kp_u_System_Postfix, __pyx_t_3, __pyx_kp_u__8, __pyx_int_170};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 460, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
          PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_kp_u_System_Postfix, __pyx_t_3, __pyx_kp_u__8, __pyx_int_170};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 460, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_13 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 460, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (__pyx_t_10) {
            __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10); __pyx_t_10 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_u_System_Postfix);
          __Pyx_GIVEREF(__pyx_kp_u_System_Postfix);
          PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_8, __pyx_kp_u_System_Postfix);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_8, __pyx_t_3);
          __Pyx_INCREF(__pyx_kp_u__8);
          __Pyx_GIVEREF(__pyx_kp_u__8);
          PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_8, __pyx_kp_u__8);
          __Pyx_INCREF(__pyx_int_170);
          __Pyx_GIVEREF(__pyx_int_170);
          PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_8, __pyx_int_170);
          __pyx_t_3 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 460, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_kp_u_System_HoldForm, __pyx_t_9};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_kp_u_System_HoldForm, __pyx_t_9};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else
        #endif
        {
          __pyx_t_13 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 458, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (__pyx_t_14) {
            __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __pyx_t_14 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_u_System_HoldForm);
          __Pyx_GIVEREF(__pyx_kp_u_System_HoldForm);
          PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_8, __pyx_kp_u_System_HoldForm);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_8, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L3_return;

        /* "mathics/core/expression.py":457
 *                     return Expression("System`HoldForm", expr)
 *             elif head == "System`RepeatedNull":
 *                 if len(leaves) == 1:             # <<<<<<<<<<<<<<
 *                     return Expression(
 *                         "System`HoldForm",
 */
      }

      /* "mathics/core/expression.py":468
 *                     )
 *                 else:
 *                     return Expression("System`HoldForm", expr)             # <<<<<<<<<<<<<<
 * 
 *             # If expr is not an atom, looks for formats in its definition
 */
      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_13 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_u_System_HoldForm, __pyx_v_expr};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_kp_u_System_HoldForm, __pyx_v_expr};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 468, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (__pyx_t_13) {
            __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_13); __pyx_t_13 = NULL;
          }
          __Pyx_INCREF(__pyx_kp_u_System_HoldForm);
          __Pyx_GIVEREF(__pyx_kp_u_System_HoldForm);
          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_u_System_HoldForm);
          __Pyx_INCREF(__pyx_v_expr);
          __Pyx_GIVEREF(__pyx_v_expr);
          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_expr);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L3_return;
      }

      /* "mathics/core/expression.py":456
 *                 else:
 *                     return Expression("System`HoldForm", expr)
 *             elif head == "System`RepeatedNull":             # <<<<<<<<<<<<<<
 *                 if len(leaves) == 1:
 *                     return Expression(
 */
    }

    /* "mathics/core/expression.py":472
 *             # If expr is not an atom, looks for formats in its definition
 *             # and apply them.
 *             def format_expr(expr):             # <<<<<<<<<<<<<<
 *                 if not (expr.is_atom()) and not (expr.head.is_atom()):
 *                     # expr is of the form f[...][...]
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_9do_format_1format_expr, 0, __pyx_n_s_BaseExpression_do_format_locals, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_format_expr = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":484
 *                 return None
 * 
 *             formatted = format_expr(expr)             # <<<<<<<<<<<<<<
 *             if formatted is not None:
 *                 result = formatted.do_format(evaluation, form)
 */
    __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_14BaseExpression_9do_format_format_expr(__pyx_v_format_expr, __pyx_v_expr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_formatted = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":485
 * 
 *             formatted = format_expr(expr)
 *             if formatted is not None:             # <<<<<<<<<<<<<<
 *                 result = formatted.do_format(evaluation, form)
 *                 if include_form:
 */
    __pyx_t_6 = (__pyx_v_formatted != Py_None);
    __pyx_t_4 = (__pyx_t_6 != 0);
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":486
 *             formatted = format_expr(expr)
 *             if formatted is not None:
 *                 result = formatted.do_format(evaluation, form)             # <<<<<<<<<<<<<<
 *                 if include_form:
 *                     result = Expression(form, result)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_formatted, __pyx_n_s_do_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(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_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_form};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_form};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_13 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 486, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_13);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
        PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_form);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_form);
        PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_8, __pyx_cur_scope->__pyx_v_form);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_result = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":487
 *             if formatted is not None:
 *                 result = formatted.do_format(evaluation, form)
 *                 if include_form:             # <<<<<<<<<<<<<<
 *                     result = Expression(form, result)
 *                 result.unformatted = unformatted
 */
      __pyx_t_4 = (__pyx_v_include_form != 0);
      if (__pyx_t_4) {

        /* "mathics/core/expression.py":488
 *                 result = formatted.do_format(evaluation, form)
 *                 if include_form:
 *                     result = Expression(form, result)             # <<<<<<<<<<<<<<
 *                 result.unformatted = unformatted
 *                 return result
 */
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_13 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_cur_scope->__pyx_v_form, __pyx_v_result};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_cur_scope->__pyx_v_form, __pyx_v_result};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L4_error)
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 488, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (__pyx_t_13) {
            __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_13); __pyx_t_13 = NULL;
          }
          __Pyx_INCREF(__pyx_cur_scope->__pyx_v_form);
          __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_form);
          PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_form);
          __Pyx_INCREF(__pyx_v_result);
          __Pyx_GIVEREF(__pyx_v_result);
          PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_result);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":487
 *             if formatted is not None:
 *                 result = formatted.do_format(evaluation, form)
 *                 if include_form:             # <<<<<<<<<<<<<<
 *                     result = Expression(form, result)
 *                 result.unformatted = unformatted
 */
      }

      /* "mathics/core/expression.py":489
 *                 if include_form:
 *                     result = Expression(form, result)
 *                 result.unformatted = unformatted             # <<<<<<<<<<<<<<
 *                 return result
 * 
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_unformatted, __pyx_v_unformatted) < 0) __PYX_ERR(0, 489, __pyx_L4_error)

      /* "mathics/core/expression.py":490
 *                     result = Expression(form, result)
 *                 result.unformatted = unformatted
 *                 return result             # <<<<<<<<<<<<<<
 * 
 *             # If the expression is still enclosed by a Format,
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      goto __pyx_L3_return;

      /* "mathics/core/expression.py":485
 * 
 *             formatted = format_expr(expr)
 *             if formatted is not None:             # <<<<<<<<<<<<<<
 *                 result = formatted.do_format(evaluation, form)
 *                 if include_form:
 */
    }

    /* "mathics/core/expression.py":496
 *             # If the expression is not atomic or of certain
 *             # specific cases, iterate over the leaves.
 *             head = expr.get_head_name()             # <<<<<<<<<<<<<<
 *             if head in formats:
 *                 expr = expr.do_format(evaluation, form)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 496, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_2 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_head, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":497
 *             # specific cases, iterate over the leaves.
 *             head = expr.get_head_name()
 *             if head in formats:             # <<<<<<<<<<<<<<
 *                 expr = expr.do_format(evaluation, form)
 *             elif (
 */
    __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_head, __pyx_v_formats, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 497, __pyx_L4_error)
    __pyx_t_6 = (__pyx_t_4 != 0);
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":498
 *             head = expr.get_head_name()
 *             if head in formats:
 *                 expr = expr.do_format(evaluation, form)             # <<<<<<<<<<<<<<
 *             elif (
 *                 head != "System`NumberForm"
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_do_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(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_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_form};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_form};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_13 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 498, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_13);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
        PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_form);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_form);
        PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_8, __pyx_cur_scope->__pyx_v_form);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":497
 *             # specific cases, iterate over the leaves.
 *             head = expr.get_head_name()
 *             if head in formats:             # <<<<<<<<<<<<<<
 *                 expr = expr.do_format(evaluation, form)
 *             elif (
 */
      goto __pyx_L19;
    }

    /* "mathics/core/expression.py":500
 *                 expr = expr.do_format(evaluation, form)
 *             elif (
 *                 head != "System`NumberForm"             # <<<<<<<<<<<<<<
 *                 and not expr.is_atom()
 *                 and head != "System`Graphics"
 */
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_head, __pyx_kp_u_System_NumberForm, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 500, __pyx_L4_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_6 = __pyx_t_4;
      goto __pyx_L20_bool_binop_done;
    }

    /* "mathics/core/expression.py":501
 *             elif (
 *                 head != "System`NumberForm"
 *                 and not expr.is_atom()             # <<<<<<<<<<<<<<
 *                 and head != "System`Graphics"
 *                 and head != "System`Graphics3D"
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_is_atom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 501, __pyx_L4_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = ((!__pyx_t_4) != 0);
    if (__pyx_t_5) {
    } else {
      __pyx_t_6 = __pyx_t_5;
      goto __pyx_L20_bool_binop_done;
    }

    /* "mathics/core/expression.py":502
 *                 head != "System`NumberForm"
 *                 and not expr.is_atom()
 *                 and head != "System`Graphics"             # <<<<<<<<<<<<<<
 *                 and head != "System`Graphics3D"
 *             ):
 */
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_head, __pyx_kp_u_System_Graphics, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 502, __pyx_L4_error)
    if (__pyx_t_5) {
    } else {
      __pyx_t_6 = __pyx_t_5;
      goto __pyx_L20_bool_binop_done;
    }

    /* "mathics/core/expression.py":503
 *                 and not expr.is_atom()
 *                 and head != "System`Graphics"
 *                 and head != "System`Graphics3D"             # <<<<<<<<<<<<<<
 *             ):
 *                 # print("Not inside graphics or numberform, and not is atom")
 */
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_head, __pyx_kp_u_System_Graphics3D, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 503, __pyx_L4_error)
    __pyx_t_6 = __pyx_t_5;
    __pyx_L20_bool_binop_done:;

    /* "mathics/core/expression.py":499
 *             if head in formats:
 *                 expr = expr.do_format(evaluation, form)
 *             elif (             # <<<<<<<<<<<<<<
 *                 head != "System`NumberForm"
 *                 and not expr.is_atom()
 */
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":506
 *             ):
 *                 # print("Not inside graphics or numberform, and not is atom")
 *                 new_leaves = [leaf.do_format(evaluation, form) for leaf in expr.leaves]             # <<<<<<<<<<<<<<
 *                 expr = Expression(expr.head.do_format(evaluation, form), *new_leaves)
 * 
 */
      { /* enter inner scope */
        __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L26_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L26_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
          __pyx_t_13 = __pyx_t_1; __Pyx_INCREF(__pyx_t_13); __pyx_t_7 = 0;
          __pyx_t_15 = NULL;
        } else {
          __pyx_t_7 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 506, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_15 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 506, __pyx_L26_error)
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        for (;;) {
          if (likely(!__pyx_t_15)) {
            if (likely(PyList_CheckExact(__pyx_t_13))) {
              if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_13)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_1 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 506, __pyx_L26_error)
              #else
              __pyx_t_1 = PySequence_ITEM(__pyx_t_13, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L26_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
            } else {
              if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_13)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 506, __pyx_L26_error)
              #else
              __pyx_t_1 = PySequence_ITEM(__pyx_t_13, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L26_error)
              __Pyx_GOTREF(__pyx_t_1);
              #endif
            }
          } else {
            __pyx_t_1 = __pyx_t_15(__pyx_t_13);
            if (unlikely(!__pyx_t_1)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 506, __pyx_L26_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_1);
          }
          __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_leaf, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr6__pyx_v_leaf, __pyx_n_s_do_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 506, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_14 = NULL;
          __pyx_t_8 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_9);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_9, function);
              __pyx_t_8 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_form};
            __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L26_error)
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_GOTREF(__pyx_t_1);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_form};
            __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L26_error)
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_GOTREF(__pyx_t_1);
          } else
          #endif
          {
            __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L26_error)
            __Pyx_GOTREF(__pyx_t_3);
            if (__pyx_t_14) {
              __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_14); __pyx_t_14 = NULL;
            }
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
            __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
            PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_evaluation);
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_form);
            __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_form);
            PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_cur_scope->__pyx_v_form);
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L26_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 506, __pyx_L26_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_leaf); __pyx_8genexpr6__pyx_v_leaf = 0;
        goto __pyx_L29_exit_scope;
        __pyx_L26_error:;
        __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_leaf); __pyx_8genexpr6__pyx_v_leaf = 0;
        goto __pyx_L4_error;
        __pyx_L29_exit_scope:;
      } /* exit inner scope */
      __pyx_v_new_leaves = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":507
 *                 # print("Not inside graphics or numberform, and not is atom")
 *                 new_leaves = [leaf.do_format(evaluation, form) for leaf in expr.leaves]
 *                 expr = Expression(expr.head.do_format(evaluation, form), *new_leaves)             # <<<<<<<<<<<<<<
 * 
 *             if include_form:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_head); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_do_format); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 507, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_form};
        __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 507, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_13);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_form};
        __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 507, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_13);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (__pyx_t_1) {
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
        }
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
        PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_form);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_form);
        PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_cur_scope->__pyx_v_form);
        __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 507, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 507, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_13);
      __pyx_t_13 = 0;
      __pyx_t_13 = PySequence_Tuple(__pyx_v_new_leaves); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 507, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_3 = PyNumber_Add(__pyx_t_9, __pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 507, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "mathics/core/expression.py":499
 *             if head in formats:
 *                 expr = expr.do_format(evaluation, form)
 *             elif (             # <<<<<<<<<<<<<<
 *                 head != "System`NumberForm"
 *                 and not expr.is_atom()
 */
    }
    __pyx_L19:;

    /* "mathics/core/expression.py":509
 *                 expr = Expression(expr.head.do_format(evaluation, form), *new_leaves)
 * 
 *             if include_form:             # <<<<<<<<<<<<<<
 *                 expr = Expression(form, expr)
 *             expr.unformatted = unformatted
 */
    __pyx_t_6 = (__pyx_v_include_form != 0);
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":510
 * 
 *             if include_form:
 *                 expr = Expression(form, expr)             # <<<<<<<<<<<<<<
 *             expr.unformatted = unformatted
 *             return expr
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_form, __pyx_v_expr};
        __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 510, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_13);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_form, __pyx_v_expr};
        __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 510, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_13);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 510, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_form);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_form);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_cur_scope->__pyx_v_form);
        __Pyx_INCREF(__pyx_v_expr);
        __Pyx_GIVEREF(__pyx_v_expr);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_expr);
        __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 510, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "mathics/core/expression.py":509
 *                 expr = Expression(expr.head.do_format(evaluation, form), *new_leaves)
 * 
 *             if include_form:             # <<<<<<<<<<<<<<
 *                 expr = Expression(form, expr)
 *             expr.unformatted = unformatted
 */
    }

    /* "mathics/core/expression.py":511
 *             if include_form:
 *                 expr = Expression(form, expr)
 *             expr.unformatted = unformatted             # <<<<<<<<<<<<<<
 *             return expr
 *         finally:
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_unformatted, __pyx_v_unformatted) < 0) __PYX_ERR(0, 511, __pyx_L4_error)

    /* "mathics/core/expression.py":512
 *                 expr = Expression(form, expr)
 *             expr.unformatted = unformatted
 *             return expr             # <<<<<<<<<<<<<<
 *         finally:
 *             evaluation.dec_recursion_depth()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_expr);
    __pyx_r = __pyx_v_expr;
    goto __pyx_L3_return;
  }

  /* "mathics/core/expression.py":514
 *             return expr
 *         finally:
 *             evaluation.dec_recursion_depth()             # <<<<<<<<<<<<<<
 * 
 *     def format(
 */
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_20);
      __Pyx_XGOTREF(__pyx_t_21);
      __Pyx_XGOTREF(__pyx_t_22);
      __Pyx_XGOTREF(__pyx_t_23);
      __pyx_t_8 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
      {
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_evaluation, __pyx_n_s_dec_recursion_depth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L32_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_13 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 514, __pyx_L32_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_23);
        __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
      }
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_19);
      __Pyx_XGIVEREF(__pyx_t_20);
      __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
      __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17;
      goto __pyx_L1_error;
      __pyx_L32_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_23);
        __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
      }
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_23 = __pyx_r;
      __pyx_r = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_evaluation, __pyx_n_s_dec_recursion_depth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_13 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 514, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_r = __pyx_t_23;
      __pyx_t_23 = 0;
      goto __pyx_L0;
    }
  }

  /* "mathics/core/expression.py":404
 *         return self, False
 * 
 *     def do_format(self, evaluation, form):             # <<<<<<<<<<<<<<
 *         """
 *         Applies formats associated to the expression and removes
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.do_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_formats);
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_head);
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_v_unformatted);
  __Pyx_XDECREF(__pyx_v_format_expr);
  __Pyx_XDECREF(__pyx_v_formatted);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_new_leaves);
  __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_leaf);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":516
 *             evaluation.dec_recursion_depth()
 * 
 *     def format(             # <<<<<<<<<<<<<<
 *         self, evaluation, form, **kwargs
 *     ) -> typing.Union["Expression", "Symbol"]:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_67format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_14BaseExpression_66format[] = "\n        Applies formats associated to the expression, and then calls Makeboxes\n        ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_67format = {"format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_67format, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_14BaseExpression_66format};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_67format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_form = 0;
  CYTHON_UNUSED 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("format (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("format", 1, 3, 3, 1); __PYX_ERR(0, 516, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("format", 1, 3, 3, 2); __PYX_ERR(0, 516, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "format") < 0)) __PYX_ERR(0, 516, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 516, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_66format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_66format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("format", 0);

  /* "mathics/core/expression.py":522
 *         Applies formats associated to the expression, and then calls Makeboxes
 *         """
 *         expr = self.do_format(evaluation, form)             # <<<<<<<<<<<<<<
 *         result = Expression("MakeBoxes", expr, Symbol(form)).evaluate(evaluation)
 *         return result
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_do_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_evaluation, __pyx_v_form};
    __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, 522, __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_evaluation, __pyx_v_form};
    __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, 522, __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, 522, __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_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_evaluation);
    __Pyx_INCREF(__pyx_v_form);
    __Pyx_GIVEREF(__pyx_v_form);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_form);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __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_v_expr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":523
 *         """
 *         expr = self.do_format(evaluation, form)
 *         result = Expression("MakeBoxes", expr, Symbol(form)).evaluate(evaluation)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Expression); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_form) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_form);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_4 = 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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_MakeBoxes, __pyx_v_expr, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __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;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_MakeBoxes, __pyx_v_expr, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __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;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_MakeBoxes);
    __Pyx_GIVEREF(__pyx_n_u_MakeBoxes);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_4, __pyx_n_u_MakeBoxes);
    __Pyx_INCREF(__pyx_v_expr);
    __Pyx_GIVEREF(__pyx_v_expr);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_4, __pyx_v_expr);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_4, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":524
 *         expr = self.do_format(evaluation, form)
 *         result = Expression("MakeBoxes", expr, Symbol(form)).evaluate(evaluation)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def is_free(self, form, evaluation) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "mathics/core/expression.py":516
 *             evaluation.dec_recursion_depth()
 * 
 *     def format(             # <<<<<<<<<<<<<<
 *         self, evaluation, form, **kwargs
 *     ) -> typing.Union["Expression", "Symbol"]:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":526
 *         return result
 * 
 *     def is_free(self, form, evaluation) -> bool:             # <<<<<<<<<<<<<<
 *         from mathics.builtin.patterns import item_is_free
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_69is_free(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_69is_free = {"is_free", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_69is_free, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_69is_free(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_form = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_free (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_form,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_free", 1, 3, 3, 1); __PYX_ERR(0, 526, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_free", 1, 3, 3, 2); __PYX_ERR(0, 526, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "is_free") < 0)) __PYX_ERR(0, 526, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_form = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("is_free", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 526, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.is_free", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_68is_free(__pyx_self, __pyx_v_self, __pyx_v_form, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_68is_free(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_form, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_item_is_free = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_free", 0);

  /* "mathics/core/expression.py":527
 * 
 *     def is_free(self, form, evaluation) -> bool:
 *         from mathics.builtin.patterns import item_is_free             # <<<<<<<<<<<<<<
 * 
 *         return item_is_free(self, form, evaluation)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_item_is_free);
  __Pyx_GIVEREF(__pyx_n_s_item_is_free);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_item_is_free);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_builtin_patterns, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 527, __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_item_is_free); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_item_is_free = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":529
 *         from mathics.builtin.patterns import item_is_free
 * 
 *         return item_is_free(self, form, evaluation)             # <<<<<<<<<<<<<<
 * 
 *     def is_inexact(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_item_is_free);
  __pyx_t_1 = __pyx_v_item_is_free; __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_self, __pyx_v_form, __pyx_v_evaluation};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_self, __pyx_v_form, __pyx_v_evaluation};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __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_form);
    __Pyx_GIVEREF(__pyx_v_form);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_form);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_evaluation);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":526
 *         return result
 * 
 *     def is_free(self, form, evaluation) -> bool:             # <<<<<<<<<<<<<<
 *         from mathics.builtin.patterns import item_is_free
 * 
 */

  /* 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("mathics.core.expression.BaseExpression.is_free", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_item_is_free);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":531
 *         return item_is_free(self, form, evaluation)
 * 
 *     def is_inexact(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_precision() is not None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_71is_inexact(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_71is_inexact = {"is_inexact", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_71is_inexact, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_71is_inexact(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_inexact (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_70is_inexact(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":532
 * 
 *     def is_inexact(self) -> bool:
 *         return self.get_precision() is not None             # <<<<<<<<<<<<<<
 * 
 *     def get_precision(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __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, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":531
 *         return item_is_free(self, form, evaluation)
 * 
 *     def is_inexact(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_precision() is not None
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.is_inexact", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":534
 *         return self.get_precision() is not None
 * 
 *     def get_precision(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_73get_precision(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_73get_precision = {"get_precision", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_73get_precision, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_73get_precision(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_72get_precision(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_72get_precision(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_precision", 0);

  /* "mathics/core/expression.py":535
 * 
 *     def get_precision(self):
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def get_option_values(self, evaluation, allow_symbols=False, stop_on_error=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":534
 *         return self.get_precision() is not None
 * 
 *     def get_precision(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "mathics/core/expression.py":537
 *         return None
 * 
 *     def get_option_values(self, evaluation, allow_symbols=False, stop_on_error=True):             # <<<<<<<<<<<<<<
 *         options = self
 *         if options.has_form("List", None):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_75get_option_values(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_75get_option_values = {"get_option_values", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_75get_option_values, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_75get_option_values(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_allow_symbols = 0;
  PyObject *__pyx_v_stop_on_error = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_option_values (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_allow_symbols,&__pyx_n_s_stop_on_error,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_False));
    values[3] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_option_values", 0, 2, 4, 1); __PYX_ERR(0, 537, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allow_symbols);
          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_stop_on_error);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_option_values") < 0)) __PYX_ERR(0, 537, __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_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_allow_symbols = values[2];
    __pyx_v_stop_on_error = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_option_values", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 537, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.get_option_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_74get_option_values(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_allow_symbols, __pyx_v_stop_on_error);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_74get_option_values(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_allow_symbols, PyObject *__pyx_v_stop_on_error) {
  PyObject *__pyx_v_options = NULL;
  PyObject *__pyx_v_values = NULL;
  PyObject *__pyx_v_option_values = NULL;
  PyObject *__pyx_v_option = NULL;
  PyObject *__pyx_v_symbol_name = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_option_values", 0);

  /* "mathics/core/expression.py":538
 * 
 *     def get_option_values(self, evaluation, allow_symbols=False, stop_on_error=True):
 *         options = self             # <<<<<<<<<<<<<<
 *         if options.has_form("List", None):
 *             options = options.flatten(SymbolList)
 */
  __Pyx_INCREF(__pyx_v_self);
  __pyx_v_options = __pyx_v_self;

  /* "mathics/core/expression.py":539
 *     def get_option_values(self, evaluation, allow_symbols=False, stop_on_error=True):
 *         options = self
 *         if options.has_form("List", None):             # <<<<<<<<<<<<<<
 *             options = options.flatten(SymbolList)
 *             values = options.leaves
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_has_form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":540
 *         options = self
 *         if options.has_form("List", None):
 *             options = options.flatten(SymbolList)             # <<<<<<<<<<<<<<
 *             values = options.leaves
 *         else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_flatten); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":541
 *         if options.has_form("List", None):
 *             options = options.flatten(SymbolList)
 *             values = options.leaves             # <<<<<<<<<<<<<<
 *         else:
 *             values = [options]
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_values = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":539
 *     def get_option_values(self, evaluation, allow_symbols=False, stop_on_error=True):
 *         options = self
 *         if options.has_form("List", None):             # <<<<<<<<<<<<<<
 *             options = options.flatten(SymbolList)
 *             values = options.leaves
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":543
 *             values = options.leaves
 *         else:
 *             values = [options]             # <<<<<<<<<<<<<<
 *         option_values = {}
 *         for option in values:
 */
  /*else*/ {
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_options);
    __pyx_v_values = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":544
 *         else:
 *             values = [options]
 *         option_values = {}             # <<<<<<<<<<<<<<
 *         for option in values:
 *             symbol_name = option.get_name()
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_option_values = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":545
 *             values = [options]
 *         option_values = {}
 *         for option in values:             # <<<<<<<<<<<<<<
 *             symbol_name = option.get_name()
 *             if allow_symbols and symbol_name:
 */
  if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
    __pyx_t_2 = __pyx_v_values; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 545, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_7(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 545, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_option, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":546
 *         option_values = {}
 *         for option in values:
 *             symbol_name = option.get_name()             # <<<<<<<<<<<<<<
 *             if allow_symbols and symbol_name:
 *                 options = evaluation.definitions.get_options(symbol_name)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_option, __pyx_n_s_get_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_symbol_name, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":547
 *         for option in values:
 *             symbol_name = option.get_name()
 *             if allow_symbols and symbol_name:             # <<<<<<<<<<<<<<
 *                 options = evaluation.definitions.get_options(symbol_name)
 *                 option_values.update(options)
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_allow_symbols); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 547, __pyx_L1_error)
    if (__pyx_t_8) {
    } else {
      __pyx_t_3 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_symbol_name); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 547, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_8;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "mathics/core/expression.py":548
 *             symbol_name = option.get_name()
 *             if allow_symbols and symbol_name:
 *                 options = evaluation.definitions.get_options(symbol_name)             # <<<<<<<<<<<<<<
 *                 option_values.update(options)
 *             else:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 548, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_options); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 548, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_symbol_name) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_symbol_name);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/core/expression.py":549
 *             if allow_symbols and symbol_name:
 *                 options = evaluation.definitions.get_options(symbol_name)
 *                 option_values.update(options)             # <<<<<<<<<<<<<<
 *             else:
 *                 if not option.has_form(("Rule", "RuleDelayed"), 2):
 */
      __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_option_values, __pyx_v_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/core/expression.py":547
 *         for option in values:
 *             symbol_name = option.get_name()
 *             if allow_symbols and symbol_name:             # <<<<<<<<<<<<<<
 *                 options = evaluation.definitions.get_options(symbol_name)
 *                 option_values.update(options)
 */
      goto __pyx_L6;
    }

    /* "mathics/core/expression.py":551
 *                 option_values.update(options)
 *             else:
 *                 if not option.has_form(("Rule", "RuleDelayed"), 2):             # <<<<<<<<<<<<<<
 *                     if stop_on_error:
 *                         return None
 */
    /*else*/ {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_option, __pyx_n_s_has_form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 551, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 551, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = ((!__pyx_t_3) != 0);
      if (__pyx_t_8) {

        /* "mathics/core/expression.py":552
 *             else:
 *                 if not option.has_form(("Rule", "RuleDelayed"), 2):
 *                     if stop_on_error:             # <<<<<<<<<<<<<<
 *                         return None
 *                     else:
 */
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_stop_on_error); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 552, __pyx_L1_error)
        if (__pyx_t_8) {

          /* "mathics/core/expression.py":553
 *                 if not option.has_form(("Rule", "RuleDelayed"), 2):
 *                     if stop_on_error:
 *                         return None             # <<<<<<<<<<<<<<
 *                     else:
 *                         continue
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_r = Py_None; __Pyx_INCREF(Py_None);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L0;

          /* "mathics/core/expression.py":552
 *             else:
 *                 if not option.has_form(("Rule", "RuleDelayed"), 2):
 *                     if stop_on_error:             # <<<<<<<<<<<<<<
 *                         return None
 *                     else:
 */
        }

        /* "mathics/core/expression.py":555
 *                         return None
 *                     else:
 *                         continue             # <<<<<<<<<<<<<<
 *                 name = option.leaves[0].get_name()
 *                 if not name and isinstance(option.leaves[0], String):
 */
        /*else*/ {
          goto __pyx_L4_continue;
        }

        /* "mathics/core/expression.py":551
 *                 option_values.update(options)
 *             else:
 *                 if not option.has_form(("Rule", "RuleDelayed"), 2):             # <<<<<<<<<<<<<<
 *                     if stop_on_error:
 *                         return None
 */
      }

      /* "mathics/core/expression.py":556
 *                     else:
 *                         continue
 *                 name = option.leaves[0].get_name()             # <<<<<<<<<<<<<<
 *                 if not name and isinstance(option.leaves[0], String):
 *                     name = ensure_context(option.leaves[0].get_string_value())
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_option, __pyx_n_s_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 556, __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_get_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __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_5 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "mathics/core/expression.py":557
 *                         continue
 *                 name = option.leaves[0].get_name()
 *                 if not name and isinstance(option.leaves[0], String):             # <<<<<<<<<<<<<<
 *                     name = ensure_context(option.leaves[0].get_string_value())
 *                 if not name:
 */
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 557, __pyx_L1_error)
      __pyx_t_9 = ((!__pyx_t_3) != 0);
      if (__pyx_t_9) {
      } else {
        __pyx_t_8 = __pyx_t_9;
        goto __pyx_L12_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_option, __pyx_n_s_leaves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_String); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = PyObject_IsInstance(__pyx_t_1, __pyx_t_5); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 557, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_3 = (__pyx_t_9 != 0);
      __pyx_t_8 = __pyx_t_3;
      __pyx_L12_bool_binop_done:;
      if (__pyx_t_8) {

        /* "mathics/core/expression.py":558
 *                 name = option.leaves[0].get_name()
 *                 if not name and isinstance(option.leaves[0], String):
 *                     name = ensure_context(option.leaves[0].get_string_value())             # <<<<<<<<<<<<<<
 *                 if not name:
 *                     if stop_on_error:
 */
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ensure_context); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_option, __pyx_n_s_leaves); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 558, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 558, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_get_string_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 558, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        __pyx_t_4 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 558, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_5 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 558, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "mathics/core/expression.py":557
 *                         continue
 *                 name = option.leaves[0].get_name()
 *                 if not name and isinstance(option.leaves[0], String):             # <<<<<<<<<<<<<<
 *                     name = ensure_context(option.leaves[0].get_string_value())
 *                 if not name:
 */
      }

      /* "mathics/core/expression.py":559
 *                 if not name and isinstance(option.leaves[0], String):
 *                     name = ensure_context(option.leaves[0].get_string_value())
 *                 if not name:             # <<<<<<<<<<<<<<
 *                     if stop_on_error:
 *                         return None
 */
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 559, __pyx_L1_error)
      __pyx_t_3 = ((!__pyx_t_8) != 0);
      if (__pyx_t_3) {

        /* "mathics/core/expression.py":560
 *                     name = ensure_context(option.leaves[0].get_string_value())
 *                 if not name:
 *                     if stop_on_error:             # <<<<<<<<<<<<<<
 *                         return None
 *                     else:
 */
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_stop_on_error); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 560, __pyx_L1_error)
        if (__pyx_t_3) {

          /* "mathics/core/expression.py":561
 *                 if not name:
 *                     if stop_on_error:
 *                         return None             # <<<<<<<<<<<<<<
 *                     else:
 *                         continue
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_r = Py_None; __Pyx_INCREF(Py_None);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L0;

          /* "mathics/core/expression.py":560
 *                     name = ensure_context(option.leaves[0].get_string_value())
 *                 if not name:
 *                     if stop_on_error:             # <<<<<<<<<<<<<<
 *                         return None
 *                     else:
 */
        }

        /* "mathics/core/expression.py":563
 *                         return None
 *                     else:
 *                         continue             # <<<<<<<<<<<<<<
 *                 option_values[name] = option.leaves[1]
 *         return option_values
 */
        /*else*/ {
          goto __pyx_L4_continue;
        }

        /* "mathics/core/expression.py":559
 *                 if not name and isinstance(option.leaves[0], String):
 *                     name = ensure_context(option.leaves[0].get_string_value())
 *                 if not name:             # <<<<<<<<<<<<<<
 *                     if stop_on_error:
 *                         return None
 */
      }

      /* "mathics/core/expression.py":564
 *                     else:
 *                         continue
 *                 option_values[name] = option.leaves[1]             # <<<<<<<<<<<<<<
 *         return option_values
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_option, __pyx_n_s_leaves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(PyDict_SetItem(__pyx_v_option_values, __pyx_v_name, __pyx_t_1) < 0)) __PYX_ERR(0, 564, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L6:;

    /* "mathics/core/expression.py":545
 *             values = [options]
 *         option_values = {}
 *         for option in values:             # <<<<<<<<<<<<<<
 *             symbol_name = option.get_name()
 *             if allow_symbols and symbol_name:
 */
    __pyx_L4_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":565
 *                         continue
 *                 option_values[name] = option.leaves[1]
 *         return option_values             # <<<<<<<<<<<<<<
 * 
 *     def get_rules_list(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_option_values);
  __pyx_r = __pyx_v_option_values;
  goto __pyx_L0;

  /* "mathics/core/expression.py":537
 *         return None
 * 
 *     def get_option_values(self, evaluation, allow_symbols=False, stop_on_error=True):             # <<<<<<<<<<<<<<
 *         options = self
 *         if options.has_form("List", None):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.get_option_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_options);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XDECREF(__pyx_v_option_values);
  __Pyx_XDECREF(__pyx_v_option);
  __Pyx_XDECREF(__pyx_v_symbol_name);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":567
 *         return option_values
 * 
 *     def get_rules_list(self):             # <<<<<<<<<<<<<<
 *         from mathics.core.rules import Rule
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_77get_rules_list(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_77get_rules_list = {"get_rules_list", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_77get_rules_list, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_77get_rules_list(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_rules_list (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_76get_rules_list(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_76get_rules_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_Rule = NULL;
  PyObject *__pyx_v_list_expr = NULL;
  PyObject *__pyx_v_list = NULL;
  PyObject *__pyx_v_rules = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_rule = 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;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_rules_list", 0);

  /* "mathics/core/expression.py":568
 * 
 *     def get_rules_list(self):
 *         from mathics.core.rules import Rule             # <<<<<<<<<<<<<<
 * 
 *         list_expr = self.flatten(SymbolList)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Rule);
  __Pyx_GIVEREF(__pyx_n_s_Rule);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Rule);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_core_rules, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 568, __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_Rule); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_Rule = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":570
 *         from mathics.core.rules import Rule
 * 
 *         list_expr = self.flatten(SymbolList)             # <<<<<<<<<<<<<<
 *         list = []
 *         if list_expr.has_form("List", None):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_flatten); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __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_2)) __PYX_ERR(0, 570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_list_expr = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":571
 * 
 *         list_expr = self.flatten(SymbolList)
 *         list = []             # <<<<<<<<<<<<<<
 *         if list_expr.has_form("List", None):
 *             list.extend(list_expr.leaves)
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_list = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":572
 *         list_expr = self.flatten(SymbolList)
 *         list = []
 *         if list_expr.has_form("List", None):             # <<<<<<<<<<<<<<
 *             list.extend(list_expr.leaves)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_list_expr, __pyx_n_s_has_form); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 572, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":573
 *         list = []
 *         if list_expr.has_form("List", None):
 *             list.extend(list_expr.leaves)             # <<<<<<<<<<<<<<
 *         else:
 *             list.append(list_expr)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_list_expr, __pyx_n_s_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyList_Extend(__pyx_v_list, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 573, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":572
 *         list_expr = self.flatten(SymbolList)
 *         list = []
 *         if list_expr.has_form("List", None):             # <<<<<<<<<<<<<<
 *             list.extend(list_expr.leaves)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":575
 *             list.extend(list_expr.leaves)
 *         else:
 *             list.append(list_expr)             # <<<<<<<<<<<<<<
 *         rules = []
 *         for item in list:
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_list, __pyx_v_list_expr); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 575, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":576
 *         else:
 *             list.append(list_expr)
 *         rules = []             # <<<<<<<<<<<<<<
 *         for item in list:
 *             if not item.has_form(("Rule", "RuleDelayed"), 2):
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rules = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":577
 *             list.append(list_expr)
 *         rules = []
 *         for item in list:             # <<<<<<<<<<<<<<
 *             if not item.has_form(("Rule", "RuleDelayed"), 2):
 *                 return None
 */
  __pyx_t_1 = __pyx_v_list; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
  for (;;) {
    if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 577, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":578
 *         rules = []
 *         for item in list:
 *             if not item.has_form(("Rule", "RuleDelayed"), 2):             # <<<<<<<<<<<<<<
 *                 return None
 *             rule = Rule(item.leaves[0], item.leaves[1])
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_has_form); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 578, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = ((!__pyx_t_5) != 0);
    if (__pyx_t_8) {

      /* "mathics/core/expression.py":579
 *         for item in list:
 *             if not item.has_form(("Rule", "RuleDelayed"), 2):
 *                 return None             # <<<<<<<<<<<<<<
 *             rule = Rule(item.leaves[0], item.leaves[1])
 *             rules.append(rule)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":578
 *         rules = []
 *         for item in list:
 *             if not item.has_form(("Rule", "RuleDelayed"), 2):             # <<<<<<<<<<<<<<
 *                 return None
 *             rule = Rule(item.leaves[0], item.leaves[1])
 */
    }

    /* "mathics/core/expression.py":580
 *             if not item.has_form(("Rule", "RuleDelayed"), 2):
 *                 return None
 *             rule = Rule(item.leaves[0], item.leaves[1])             # <<<<<<<<<<<<<<
 *             rules.append(rule)
 *         return rules
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_item, __pyx_n_s_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 580, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v_Rule);
    __pyx_t_2 = __pyx_v_Rule; __pyx_t_10 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_4, __pyx_t_9};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 580, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_4, __pyx_t_9};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 580, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_9);
      __pyx_t_4 = 0;
      __pyx_t_9 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_rule, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":581
 *                 return None
 *             rule = Rule(item.leaves[0], item.leaves[1])
 *             rules.append(rule)             # <<<<<<<<<<<<<<
 *         return rules
 * 
 */
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_rules, __pyx_v_rule); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 581, __pyx_L1_error)

    /* "mathics/core/expression.py":577
 *             list.append(list_expr)
 *         rules = []
 *         for item in list:             # <<<<<<<<<<<<<<
 *             if not item.has_form(("Rule", "RuleDelayed"), 2):
 *                 return None
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":582
 *             rule = Rule(item.leaves[0], item.leaves[1])
 *             rules.append(rule)
 *         return rules             # <<<<<<<<<<<<<<
 * 
 *     def to_sympy(self, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rules);
  __pyx_r = __pyx_v_rules;
  goto __pyx_L0;

  /* "mathics/core/expression.py":567
 *         return option_values
 * 
 *     def get_rules_list(self):             # <<<<<<<<<<<<<<
 *         from mathics.core.rules import Rule
 * 
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.get_rules_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Rule);
  __Pyx_XDECREF(__pyx_v_list_expr);
  __Pyx_XDECREF(__pyx_v_list);
  __Pyx_XDECREF(__pyx_v_rules);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_rule);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":584
 *         return rules
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_79to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_79to_sympy = {"to_sympy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_79to_sympy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_79to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED 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("to_sympy (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "to_sympy") < 0)) __PYX_ERR(0, 584, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_sympy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 584, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_78to_sympy(__pyx_self, __pyx_v_self, __pyx_v_kwargs);

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

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

  /* "mathics/core/expression.py":585
 * 
 *     def to_sympy(self, **kwargs):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def to_mpmath(self):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 585, __pyx_L1_error)

  /* "mathics/core/expression.py":584
 *         return rules
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":587
 *         raise NotImplementedError
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_81to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_81to_mpmath = {"to_mpmath", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_81to_mpmath, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_81to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_mpmath (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_80to_mpmath(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_80to_mpmath(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_mpmath", 0);

  /* "mathics/core/expression.py":588
 * 
 *     def to_mpmath(self):
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def round_to_float(self, evaluation=None, permit_complex=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":587
 *         raise NotImplementedError
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "mathics/core/expression.py":590
 *         return None
 * 
 *     def round_to_float(self, evaluation=None, permit_complex=False):             # <<<<<<<<<<<<<<
 *         """
 *         Try to round to python float. Return None if not possible.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_83round_to_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_14BaseExpression_82round_to_float[] = "\n        Try to round to python float. Return None if not possible.\n        ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_83round_to_float = {"round_to_float", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_83round_to_float, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_14BaseExpression_82round_to_float};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_83round_to_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_permit_complex = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("round_to_float (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_permit_complex,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation);
          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_permit_complex);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "round_to_float") < 0)) __PYX_ERR(0, 590, __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_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_permit_complex = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("round_to_float", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 590, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.round_to_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_82round_to_float(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_permit_complex);

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

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

  /* "mathics/core/expression.py":594
 *         Try to round to python float. Return None if not possible.
 *         """
 *         if evaluation is None:             # <<<<<<<<<<<<<<
 *             value = self
 *         else:
 */
  __pyx_t_1 = (__pyx_v_evaluation == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":595
 *         """
 *         if evaluation is None:
 *             value = self             # <<<<<<<<<<<<<<
 *         else:
 *             value = Expression(SymbolN, self).evaluate(evaluation)
 */
    __Pyx_INCREF(__pyx_v_self);
    __pyx_v_value = __pyx_v_self;

    /* "mathics/core/expression.py":594
 *         Try to round to python float. Return None if not possible.
 *         """
 *         if evaluation is None:             # <<<<<<<<<<<<<<
 *             value = self
 *         else:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":597
 *             value = self
 *         else:
 *             value = Expression(SymbolN, self).evaluate(evaluation)             # <<<<<<<<<<<<<<
 *         if isinstance(value, Number):
 *             value = value.round()
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Expression); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_self};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_self};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 597, __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_6);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_self);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_evaluation);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_value = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":598
 *         else:
 *             value = Expression(SymbolN, self).evaluate(evaluation)
 *         if isinstance(value, Number):             # <<<<<<<<<<<<<<
 *             value = value.round()
 *             return value.get_float_value(permit_complex=permit_complex)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Number); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_3); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 598, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":599
 *             value = Expression(SymbolN, self).evaluate(evaluation)
 *         if isinstance(value, Number):
 *             value = value.round()             # <<<<<<<<<<<<<<
 *             return value.get_float_value(permit_complex=permit_complex)
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_round); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 599, __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_3 = (__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_3)) __PYX_ERR(0, 599, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":600
 *         if isinstance(value, Number):
 *             value = value.round()
 *             return value.get_float_value(permit_complex=permit_complex)             # <<<<<<<<<<<<<<
 * 
 *     def __abs__(self) -> "Expression":
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_get_float_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_permit_complex, __pyx_v_permit_complex) < 0) __PYX_ERR(0, 600, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 600, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":598
 *         else:
 *             value = Expression(SymbolN, self).evaluate(evaluation)
 *         if isinstance(value, Number):             # <<<<<<<<<<<<<<
 *             value = value.round()
 *             return value.get_float_value(permit_complex=permit_complex)
 */
  }

  /* "mathics/core/expression.py":590
 *         return None
 * 
 *     def round_to_float(self, evaluation=None, permit_complex=False):             # <<<<<<<<<<<<<<
 *         """
 *         Try to round to python float. Return None if not possible.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.round_to_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":602
 *             return value.get_float_value(permit_complex=permit_complex)
 * 
 *     def __abs__(self) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Abs", self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_85__abs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_85__abs__ = {"__abs__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_85__abs__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_85__abs__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__abs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_84__abs__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":603
 * 
 *     def __abs__(self) -> "Expression":
 *         return Expression("Abs", self)             # <<<<<<<<<<<<<<
 * 
 *     def __pos__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __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_n_u_Abs, __pyx_v_self};
    __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, 603, __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_n_u_Abs, __pyx_v_self};
    __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, 603, __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, 603, __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_n_u_Abs);
    __Pyx_GIVEREF(__pyx_n_u_Abs);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_Abs);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_self);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __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;

  /* "mathics/core/expression.py":602
 *             return value.get_float_value(permit_complex=permit_complex)
 * 
 *     def __abs__(self) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Abs", 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_5);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__abs__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":605
 *         return Expression("Abs", self)
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_87__pos__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_87__pos__ = {"__pos__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_87__pos__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_87__pos__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pos__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_86__pos__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_86__pos__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pos__", 0);

  /* "mathics/core/expression.py":606
 * 
 *     def __pos__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":605
 *         return Expression("Abs", self)
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "mathics/core/expression.py":608
 *         return self
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return Expression("Times", self, -1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_89__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_89__neg__ = {"__neg__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_14BaseExpression_89__neg__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_89__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_88__neg__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":609
 * 
 *     def __neg__(self):
 *         return Expression("Times", self, -1)             # <<<<<<<<<<<<<<
 * 
 *     def __add__(self, other) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Times, __pyx_v_self, __pyx_int_neg_1};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Times, __pyx_v_self, __pyx_int_neg_1};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 609, __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_n_u_Times);
    __Pyx_GIVEREF(__pyx_n_u_Times);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_Times);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_self);
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_GIVEREF(__pyx_int_neg_1);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_int_neg_1);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __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;

  /* "mathics/core/expression.py":608
 *         return self
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return Expression("Times", self, -1)
 * 
 */

  /* 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("mathics.core.expression.BaseExpression.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":611
 *         return Expression("Times", self, -1)
 * 
 *     def __add__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Plus", self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_91__add__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_91__add__ = {"__add__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_91__add__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_91__add__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 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_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__add__", 1, 2, 2, 1); __PYX_ERR(0, 611, __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, 611, __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_other = 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, 611, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_90__add__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_90__add__(CYTHON_UNUSED PyObject *__pyx_self, 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("__add__", 0);

  /* "mathics/core/expression.py":612
 * 
 *     def __add__(self, other) -> "Expression":
 *         return Expression("Plus", self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(self, other) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Plus, __pyx_v_self, __pyx_v_other};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Plus, __pyx_v_self, __pyx_v_other};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 612, __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_n_u_Plus);
    __Pyx_GIVEREF(__pyx_n_u_Plus);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_Plus);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__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, 612, __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;

  /* "mathics/core/expression.py":611
 *         return Expression("Times", self, -1)
 * 
 *     def __add__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Plus", 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("mathics.core.expression.BaseExpression.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":614
 *         return Expression("Plus", self, other)
 * 
 *     def __sub__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Plus", self, Expression("Times", other, -1))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_93__sub__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_93__sub__ = {"__sub__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_93__sub__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_93__sub__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__sub__", 1, 2, 2, 1); __PYX_ERR(0, 614, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__sub__") < 0)) __PYX_ERR(0, 614, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__sub__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 614, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_92__sub__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_92__sub__(CYTHON_UNUSED PyObject *__pyx_self, 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;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__sub__", 0);

  /* "mathics/core/expression.py":615
 * 
 *     def __sub__(self, other) -> "Expression":
 *         return Expression("Plus", self, Expression("Times", other, -1))             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(self, other) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_n_u_Times, __pyx_v_other, __pyx_int_neg_1};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_n_u_Times, __pyx_v_other, __pyx_int_neg_1};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_Times);
    __Pyx_GIVEREF(__pyx_n_u_Times);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_n_u_Times);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_other);
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_GIVEREF(__pyx_int_neg_1);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_int_neg_1);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_n_u_Plus, __pyx_v_self, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_n_u_Plus, __pyx_v_self, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_Plus);
    __Pyx_GIVEREF(__pyx_n_u_Plus);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_n_u_Plus);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":614
 *         return Expression("Plus", self, other)
 * 
 *     def __sub__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Plus", self, Expression("Times", other, -1))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":617
 *         return Expression("Plus", self, Expression("Times", other, -1))
 * 
 *     def __mul__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Times", self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_95__mul__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_95__mul__ = {"__mul__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_95__mul__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_95__mul__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__mul__", 1, 2, 2, 1); __PYX_ERR(0, 617, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__mul__") < 0)) __PYX_ERR(0, 617, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__mul__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 617, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_94__mul__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_94__mul__(CYTHON_UNUSED PyObject *__pyx_self, 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("__mul__", 0);

  /* "mathics/core/expression.py":618
 * 
 *     def __mul__(self, other) -> "Expression":
 *         return Expression("Times", self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __truediv__(self, other) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Times, __pyx_v_self, __pyx_v_other};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Times, __pyx_v_self, __pyx_v_other};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 618, __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_n_u_Times);
    __Pyx_GIVEREF(__pyx_n_u_Times);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_Times);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__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, 618, __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;

  /* "mathics/core/expression.py":617
 *         return Expression("Plus", self, Expression("Times", other, -1))
 * 
 *     def __mul__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Times", 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("mathics.core.expression.BaseExpression.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":620
 *         return Expression("Times", self, other)
 * 
 *     def __truediv__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Divide", self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_97__truediv__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_97__truediv__ = {"__truediv__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_97__truediv__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_97__truediv__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__truediv__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__truediv__", 1, 2, 2, 1); __PYX_ERR(0, 620, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__truediv__") < 0)) __PYX_ERR(0, 620, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__truediv__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 620, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__truediv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_96__truediv__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_96__truediv__(CYTHON_UNUSED PyObject *__pyx_self, 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("__truediv__", 0);

  /* "mathics/core/expression.py":621
 * 
 *     def __truediv__(self, other) -> "Expression":
 *         return Expression("Divide", self, other)             # <<<<<<<<<<<<<<
 * 
 *     def __floordiv__(self, other) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Divide, __pyx_v_self, __pyx_v_other};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Divide, __pyx_v_self, __pyx_v_other};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 621, __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_n_u_Divide);
    __Pyx_GIVEREF(__pyx_n_u_Divide);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_Divide);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__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, 621, __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;

  /* "mathics/core/expression.py":620
 *         return Expression("Times", self, other)
 * 
 *     def __truediv__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Divide", 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("mathics.core.expression.BaseExpression.__truediv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":623
 *         return Expression("Divide", self, other)
 * 
 *     def __floordiv__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Floor", Expression("Divide", self, other))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_99__floordiv__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_99__floordiv__ = {"__floordiv__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_99__floordiv__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_99__floordiv__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__floordiv__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__floordiv__", 1, 2, 2, 1); __PYX_ERR(0, 623, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__floordiv__") < 0)) __PYX_ERR(0, 623, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__floordiv__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 623, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__floordiv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_98__floordiv__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_98__floordiv__(CYTHON_UNUSED PyObject *__pyx_self, 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;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__floordiv__", 0);

  /* "mathics/core/expression.py":624
 * 
 *     def __floordiv__(self, other) -> "Expression":
 *         return Expression("Floor", Expression("Divide", self, other))             # <<<<<<<<<<<<<<
 * 
 *     def __pow__(self, other) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_n_u_Divide, __pyx_v_self, __pyx_v_other};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_n_u_Divide, __pyx_v_self, __pyx_v_other};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_Divide);
    __Pyx_GIVEREF(__pyx_n_u_Divide);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_n_u_Divide);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_other);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_u_Floor, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_u_Floor, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_Floor);
    __Pyx_GIVEREF(__pyx_n_u_Floor);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_n_u_Floor);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":623
 *         return Expression("Divide", self, other)
 * 
 *     def __floordiv__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Floor", Expression("Divide", 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__floordiv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":626
 *         return Expression("Floor", Expression("Divide", self, other))
 * 
 *     def __pow__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Power", self, other)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_101__pow__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_14BaseExpression_101__pow__ = {"__pow__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_14BaseExpression_101__pow__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_14BaseExpression_101__pow__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pow__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pow__", 1, 2, 2, 1); __PYX_ERR(0, 626, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pow__") < 0)) __PYX_ERR(0, 626, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pow__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 626, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.BaseExpression.__pow__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14BaseExpression_100__pow__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14BaseExpression_100__pow__(CYTHON_UNUSED PyObject *__pyx_self, 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("__pow__", 0);

  /* "mathics/core/expression.py":627
 * 
 *     def __pow__(self, other) -> "Expression":
 *         return Expression("Power", self, other)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Power, __pyx_v_self, __pyx_v_other};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Power, __pyx_v_self, __pyx_v_other};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 627, __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_n_u_Power);
    __Pyx_GIVEREF(__pyx_n_u_Power);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_Power);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_other);
    __Pyx_GIVEREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__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, 627, __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;

  /* "mathics/core/expression.py":626
 *         return Expression("Floor", Expression("Divide", self, other))
 * 
 *     def __pow__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Power", 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("mathics.core.expression.BaseExpression.__pow__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":636
 *     """
 * 
 *     def __init__(self, exps_dict):             # <<<<<<<<<<<<<<
 *         self.exps = exps_dict
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Monomial_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Monomial_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_exps_dict = 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_exps_dict,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_exps_dict)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 636, __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, 636, __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_exps_dict = 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, 636, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Monomial___init__(__pyx_self, __pyx_v_self, __pyx_v_exps_dict);

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

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

  /* "mathics/core/expression.py":637
 * 
 *     def __init__(self, exps_dict):
 *         self.exps = exps_dict             # <<<<<<<<<<<<<<
 * 
 *     def __lt__(self, other) -> bool:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_exps, __pyx_v_exps_dict) < 0) __PYX_ERR(0, 637, __pyx_L1_error)

  /* "mathics/core/expression.py":636
 *     """
 * 
 *     def __init__(self, exps_dict):             # <<<<<<<<<<<<<<
 *         self.exps = exps_dict
 * 
 */

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

/* "mathics/core/expression.py":639
 *         self.exps = exps_dict
 * 
 *     def __lt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) < 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_3__lt__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Monomial_3__lt__ = {"__lt__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Monomial_3__lt__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_3__lt__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__lt__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__lt__", 1, 2, 2, 1); __PYX_ERR(0, 639, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__lt__") < 0)) __PYX_ERR(0, 639, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__lt__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 639, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__lt__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Monomial_2__lt__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":640
 * 
 *     def __lt__(self, other) -> bool:
 *         return self.__cmp(other) < 0             # <<<<<<<<<<<<<<
 * 
 *     def __gt__(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Monomial__cmp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __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, 640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":639
 *         self.exps = exps_dict
 * 
 *     def __lt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) < 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__lt__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":642
 *         return self.__cmp(other) < 0
 * 
 *     def __gt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) > 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_5__gt__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Monomial_5__gt__ = {"__gt__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Monomial_5__gt__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_5__gt__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__gt__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__gt__", 1, 2, 2, 1); __PYX_ERR(0, 642, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__gt__") < 0)) __PYX_ERR(0, 642, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__gt__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 642, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__gt__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Monomial_4__gt__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":643
 * 
 *     def __gt__(self, other) -> bool:
 *         return self.__cmp(other) > 0             # <<<<<<<<<<<<<<
 * 
 *     def __le__(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Monomial__cmp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __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, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":642
 *         return self.__cmp(other) < 0
 * 
 *     def __gt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) > 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__gt__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":645
 *         return self.__cmp(other) > 0
 * 
 *     def __le__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) <= 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_7__le__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Monomial_7__le__ = {"__le__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Monomial_7__le__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_7__le__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__le__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__le__", 1, 2, 2, 1); __PYX_ERR(0, 645, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__le__") < 0)) __PYX_ERR(0, 645, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__le__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 645, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__le__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Monomial_6__le__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":646
 * 
 *     def __le__(self, other) -> bool:
 *         return self.__cmp(other) <= 0             # <<<<<<<<<<<<<<
 * 
 *     def __ge__(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Monomial__cmp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __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, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":645
 *         return self.__cmp(other) > 0
 * 
 *     def __le__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) <= 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__le__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":648
 *         return self.__cmp(other) <= 0
 * 
 *     def __ge__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) >= 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_9__ge__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Monomial_9__ge__ = {"__ge__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Monomial_9__ge__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_9__ge__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__ge__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__ge__", 1, 2, 2, 1); __PYX_ERR(0, 648, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__ge__") < 0)) __PYX_ERR(0, 648, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__ge__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 648, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__ge__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Monomial_8__ge__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":649
 * 
 *     def __ge__(self, other) -> bool:
 *         return self.__cmp(other) >= 0             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Monomial__cmp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 649, __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, 649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 649, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":648
 *         return self.__cmp(other) <= 0
 * 
 *     def __ge__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) >= 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__ge__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":651
 *         return self.__cmp(other) >= 0
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) == 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_11__eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Monomial_11__eq__ = {"__eq__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Monomial_11__eq__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_11__eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, 1); __PYX_ERR(0, 651, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__eq__") < 0)) __PYX_ERR(0, 651, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 651, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Monomial_10__eq__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":652
 * 
 *     def __eq__(self, other) -> bool:
 *         return self.__cmp(other) == 0             # <<<<<<<<<<<<<<
 * 
 *     def __ne__(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Monomial__cmp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 652, __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, 652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 652, __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;

  /* "mathics/core/expression.py":651
 *         return self.__cmp(other) >= 0
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) == 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":654
 *         return self.__cmp(other) == 0
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) != 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_13__ne__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Monomial_13__ne__ = {"__ne__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Monomial_13__ne__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_13__ne__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__ne__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__ne__", 1, 2, 2, 1); __PYX_ERR(0, 654, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__ne__") < 0)) __PYX_ERR(0, 654, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__ne__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 654, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__ne__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Monomial_12__ne__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":655
 * 
 *     def __ne__(self, other) -> bool:
 *         return self.__cmp(other) != 0             # <<<<<<<<<<<<<<
 * 
 *     def __cmp(self, other) -> int:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Monomial__cmp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __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, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_NeObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":654
 *         return self.__cmp(other) == 0
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) != 0
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__ne__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":657
 *         return self.__cmp(other) != 0
 * 
 *     def __cmp(self, other) -> int:             # <<<<<<<<<<<<<<
 *         self_exps = self.exps.copy()
 *         other_exps = other.exps.copy()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_15__cmp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Monomial_15__cmp = {"__cmp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Monomial_15__cmp, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Monomial_15__cmp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cmp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cmp", 1, 2, 2, 1); __PYX_ERR(0, 657, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cmp") < 0)) __PYX_ERR(0, 657, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cmp", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 657, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__cmp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Monomial_14__cmp(__pyx_self, __pyx_v_self, __pyx_v_other);

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

/* "mathics/core/expression.py":669
 *                 if not other_exps[var]:
 *                     del other_exps[var]
 *         self_exps = sorted((var, exp) for var, exp in self_exps.items())             # <<<<<<<<<<<<<<
 *         other_exps = sorted((var, exp) for var, exp in other_exps.items())
 * 
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_5__cmp_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_4_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_4_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 669, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *) __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_7mathics_4core_10expression_8Monomial_5__cmp_2generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Monomial___cmp_locals_genexpr, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__cmp.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_7mathics_4core_10expression_8Monomial_5__cmp_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 669, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self_exps)) { __Pyx_RaiseClosureNameError("self_exps"); __PYX_ERR(0, 669, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self_exps == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 669, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self_exps, 0, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_var);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_var, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_exp);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_exp, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_var);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_var);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_var);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_exp);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_exp);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_exp);
    if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_4core_10expression_8Monomial_5__cmp_5generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/core/expression.py":670
 *                     del other_exps[var]
 *         self_exps = sorted((var, exp) for var, exp in self_exps.items())
 *         other_exps = sorted((var, exp) for var, exp in other_exps.items())             # <<<<<<<<<<<<<<
 * 
 *         index = 0
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_5__cmp_3genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_5_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 670, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *) __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_7mathics_4core_10expression_8Monomial_5__cmp_5generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Monomial___cmp_locals_genexpr, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 670, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__cmp.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_7mathics_4core_10expression_8Monomial_5__cmp_5generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 670, __pyx_L1_error)
  __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_other_exps)) { __Pyx_RaiseClosureNameError("other_exps"); __PYX_ERR(0, 670, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_other_exps == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 670, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_other_exps, 0, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_var);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_var, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_exp);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_exp, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_var);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_var);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_var);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_exp);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_exp);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_exp);
    if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 670, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

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

/* "mathics/core/expression.py":657
 *         return self.__cmp(other) != 0
 * 
 *     def __cmp(self, other) -> int:             # <<<<<<<<<<<<<<
 *         self_exps = self.exps.copy()
 *         other_exps = other.exps.copy()
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_8Monomial_14__cmp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *__pyx_cur_scope;
  PyObject *__pyx_v_var = NULL;
  PyObject *__pyx_v_dec = NULL;
  PyObject *__pyx_v_index = NULL;
  Py_ssize_t __pyx_v_self_len;
  Py_ssize_t __pyx_v_other_len;
  PyObject *__pyx_v_self_var = NULL;
  PyObject *__pyx_v_self_exp = NULL;
  PyObject *__pyx_v_other_var = NULL;
  PyObject *__pyx_v_other_exp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cmp", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_3___cmp(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_3___cmp, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 657, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }

  /* "mathics/core/expression.py":658
 * 
 *     def __cmp(self, other) -> int:
 *         self_exps = self.exps.copy()             # <<<<<<<<<<<<<<
 *         other_exps = other.exps.copy()
 *         for var in self.exps:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_exps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_self_exps = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":659
 *     def __cmp(self, other) -> int:
 *         self_exps = self.exps.copy()
 *         other_exps = other.exps.copy()             # <<<<<<<<<<<<<<
 *         for var in self.exps:
 *             if var in other.exps:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_exps); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __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, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_other_exps = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":660
 *         self_exps = self.exps.copy()
 *         other_exps = other.exps.copy()
 *         for var in self.exps:             # <<<<<<<<<<<<<<
 *             if var in other.exps:
 *                 dec = min(self_exps[var], other_exps[var])
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_exps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 660, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 660, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 660, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 660, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_var, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":661
 *         other_exps = other.exps.copy()
 *         for var in self.exps:
 *             if var in other.exps:             # <<<<<<<<<<<<<<
 *                 dec = min(self_exps[var], other_exps[var])
 *                 self_exps[var] -= dec
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_exps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_var, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 661, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = (__pyx_t_6 != 0);
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":662
 *         for var in self.exps:
 *             if var in other.exps:
 *                 dec = min(self_exps[var], other_exps[var])             # <<<<<<<<<<<<<<
 *                 self_exps[var] -= dec
 *                 if not self_exps[var]:
 */
      __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_other_exps, __pyx_v_var); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_self_exps, __pyx_v_var); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 662, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_7) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_8 = __pyx_t_1;
      } else {
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_8 = __pyx_t_3;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __pyx_t_8;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_dec, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/core/expression.py":663
 *             if var in other.exps:
 *                 dec = min(self_exps[var], other_exps[var])
 *                 self_exps[var] -= dec             # <<<<<<<<<<<<<<
 *                 if not self_exps[var]:
 *                     del self_exps[var]
 */
      __Pyx_INCREF(__pyx_v_var);
      __pyx_t_1 = __pyx_v_var;
      __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_self_exps, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 663, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_8, __pyx_v_dec); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_self_exps, __pyx_t_1, __pyx_t_3) < 0)) __PYX_ERR(0, 663, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/core/expression.py":664
 *                 dec = min(self_exps[var], other_exps[var])
 *                 self_exps[var] -= dec
 *                 if not self_exps[var]:             # <<<<<<<<<<<<<<
 *                     del self_exps[var]
 *                 other_exps[var] -= dec
 */
      __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_self_exps, __pyx_v_var); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 664, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 664, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = ((!__pyx_t_7) != 0);
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":665
 *                 self_exps[var] -= dec
 *                 if not self_exps[var]:
 *                     del self_exps[var]             # <<<<<<<<<<<<<<
 *                 other_exps[var] -= dec
 *                 if not other_exps[var]:
 */
        if (unlikely(PyObject_DelItem(__pyx_cur_scope->__pyx_v_self_exps, __pyx_v_var) < 0)) __PYX_ERR(0, 665, __pyx_L1_error)

        /* "mathics/core/expression.py":664
 *                 dec = min(self_exps[var], other_exps[var])
 *                 self_exps[var] -= dec
 *                 if not self_exps[var]:             # <<<<<<<<<<<<<<
 *                     del self_exps[var]
 *                 other_exps[var] -= dec
 */
      }

      /* "mathics/core/expression.py":666
 *                 if not self_exps[var]:
 *                     del self_exps[var]
 *                 other_exps[var] -= dec             # <<<<<<<<<<<<<<
 *                 if not other_exps[var]:
 *                     del other_exps[var]
 */
      __Pyx_INCREF(__pyx_v_var);
      __pyx_t_1 = __pyx_v_var;
      __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_other_exps, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_v_dec); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_other_exps, __pyx_t_1, __pyx_t_8) < 0)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/core/expression.py":667
 *                     del self_exps[var]
 *                 other_exps[var] -= dec
 *                 if not other_exps[var]:             # <<<<<<<<<<<<<<
 *                     del other_exps[var]
 *         self_exps = sorted((var, exp) for var, exp in self_exps.items())
 */
      __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_other_exps, __pyx_v_var); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 667, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = ((!__pyx_t_6) != 0);
      if (__pyx_t_7) {

        /* "mathics/core/expression.py":668
 *                 other_exps[var] -= dec
 *                 if not other_exps[var]:
 *                     del other_exps[var]             # <<<<<<<<<<<<<<
 *         self_exps = sorted((var, exp) for var, exp in self_exps.items())
 *         other_exps = sorted((var, exp) for var, exp in other_exps.items())
 */
        if (unlikely(PyObject_DelItem(__pyx_cur_scope->__pyx_v_other_exps, __pyx_v_var) < 0)) __PYX_ERR(0, 668, __pyx_L1_error)

        /* "mathics/core/expression.py":667
 *                     del self_exps[var]
 *                 other_exps[var] -= dec
 *                 if not other_exps[var]:             # <<<<<<<<<<<<<<
 *                     del other_exps[var]
 *         self_exps = sorted((var, exp) for var, exp in self_exps.items())
 */
      }

      /* "mathics/core/expression.py":661
 *         other_exps = other.exps.copy()
 *         for var in self.exps:
 *             if var in other.exps:             # <<<<<<<<<<<<<<
 *                 dec = min(self_exps[var], other_exps[var])
 *                 self_exps[var] -= dec
 */
    }

    /* "mathics/core/expression.py":660
 *         self_exps = self.exps.copy()
 *         other_exps = other.exps.copy()
 *         for var in self.exps:             # <<<<<<<<<<<<<<
 *             if var in other.exps:
 *                 dec = min(self_exps[var], other_exps[var])
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":669
 *                 if not other_exps[var]:
 *                     del other_exps[var]
 *         self_exps = sorted((var, exp) for var, exp in self_exps.items())             # <<<<<<<<<<<<<<
 *         other_exps = sorted((var, exp) for var, exp in other_exps.items())
 * 
 */
  __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_8Monomial_5__cmp_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_10 = PyList_Sort(__pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self_exps);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_self_exps, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":670
 *                     del other_exps[var]
 *         self_exps = sorted((var, exp) for var, exp in self_exps.items())
 *         other_exps = sorted((var, exp) for var, exp in other_exps.items())             # <<<<<<<<<<<<<<
 * 
 *         index = 0
 */
  __pyx_t_8 = __pyx_pf_7mathics_4core_10expression_8Monomial_5__cmp_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = __Pyx_Generator_Next(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_2 = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_10 = PyList_Sort(__pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_other_exps);
  __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_other_exps, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":672
 *         other_exps = sorted((var, exp) for var, exp in other_exps.items())
 * 
 *         index = 0             # <<<<<<<<<<<<<<
 *         self_len = len(self_exps)
 *         other_len = len(other_exps)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_index = __pyx_int_0;

  /* "mathics/core/expression.py":673
 * 
 *         index = 0
 *         self_len = len(self_exps)             # <<<<<<<<<<<<<<
 *         other_len = len(other_exps)
 *         while True:
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self_exps;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 673, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_self_len = __pyx_t_4;

  /* "mathics/core/expression.py":674
 *         index = 0
 *         self_len = len(self_exps)
 *         other_len = len(other_exps)             # <<<<<<<<<<<<<<
 *         while True:
 *             if index >= self_len and index >= other_len:
 */
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_other_exps;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 674, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_other_len = __pyx_t_4;

  /* "mathics/core/expression.py":675
 *         self_len = len(self_exps)
 *         other_len = len(other_exps)
 *         while True:             # <<<<<<<<<<<<<<
 *             if index >= self_len and index >= other_len:
 *                 return 0
 */
  while (1) {

    /* "mathics/core/expression.py":676
 *         other_len = len(other_exps)
 *         while True:
 *             if index >= self_len and index >= other_len:             # <<<<<<<<<<<<<<
 *                 return 0
 *             if index >= self_len:
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_index, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 676, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_6) {
    } else {
      __pyx_t_7 = __pyx_t_6;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_other_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_index, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 676, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __pyx_t_6;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":677
 *         while True:
 *             if index >= self_len and index >= other_len:
 *                 return 0             # <<<<<<<<<<<<<<
 *             if index >= self_len:
 *                 return -1  # self < other
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_0);
      __pyx_r = __pyx_int_0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":676
 *         other_len = len(other_exps)
 *         while True:
 *             if index >= self_len and index >= other_len:             # <<<<<<<<<<<<<<
 *                 return 0
 *             if index >= self_len:
 */
    }

    /* "mathics/core/expression.py":678
 *             if index >= self_len and index >= other_len:
 *                 return 0
 *             if index >= self_len:             # <<<<<<<<<<<<<<
 *                 return -1  # self < other
 *             if index >= other_len:
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 678, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_index, __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 678, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 678, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":679
 *                 return 0
 *             if index >= self_len:
 *                 return -1  # self < other             # <<<<<<<<<<<<<<
 *             if index >= other_len:
 *                 return 1  # self > other
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_neg_1);
      __pyx_r = __pyx_int_neg_1;
      goto __pyx_L0;

      /* "mathics/core/expression.py":678
 *             if index >= self_len and index >= other_len:
 *                 return 0
 *             if index >= self_len:             # <<<<<<<<<<<<<<
 *                 return -1  # self < other
 *             if index >= other_len:
 */
    }

    /* "mathics/core/expression.py":680
 *             if index >= self_len:
 *                 return -1  # self < other
 *             if index >= other_len:             # <<<<<<<<<<<<<<
 *                 return 1  # self > other
 *             self_var, self_exp = self_exps[index]
 */
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_other_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_index, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 680, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":681
 *                 return -1  # self < other
 *             if index >= other_len:
 *                 return 1  # self > other             # <<<<<<<<<<<<<<
 *             self_var, self_exp = self_exps[index]
 *             other_var, other_exp = other_exps[index]
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_1);
      __pyx_r = __pyx_int_1;
      goto __pyx_L0;

      /* "mathics/core/expression.py":680
 *             if index >= self_len:
 *                 return -1  # self < other
 *             if index >= other_len:             # <<<<<<<<<<<<<<
 *                 return 1  # self > other
 *             self_var, self_exp = self_exps[index]
 */
    }

    /* "mathics/core/expression.py":682
 *             if index >= other_len:
 *                 return 1  # self > other
 *             self_var, self_exp = self_exps[index]             # <<<<<<<<<<<<<<
 *             other_var, other_exp = other_exps[index]
 *             if self_var < other_var:
 */
    if (unlikely(__pyx_cur_scope->__pyx_v_self_exps == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 682, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_self_exps, __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 682, __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_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 682, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_8 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_8)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_3), 2) < 0) __PYX_ERR(0, 682, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L16_unpacking_done;
      __pyx_L15_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 682, __pyx_L1_error)
      __pyx_L16_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_self_var, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_self_exp, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "mathics/core/expression.py":683
 *                 return 1  # self > other
 *             self_var, self_exp = self_exps[index]
 *             other_var, other_exp = other_exps[index]             # <<<<<<<<<<<<<<
 *             if self_var < other_var:
 *                 return -1
 */
    if (unlikely(__pyx_cur_scope->__pyx_v_other_exps == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 683, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_other_exps, __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 683, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_8)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_1 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_3), 2) < 0) __PYX_ERR(0, 683, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L18_unpacking_done;
      __pyx_L17_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 683, __pyx_L1_error)
      __pyx_L18_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_other_var, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_other_exp, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":684
 *             self_var, self_exp = self_exps[index]
 *             other_var, other_exp = other_exps[index]
 *             if self_var < other_var:             # <<<<<<<<<<<<<<
 *                 return -1
 *             if self_var > other_var:
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_self_var, __pyx_v_other_var, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 684, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 684, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":685
 *             other_var, other_exp = other_exps[index]
 *             if self_var < other_var:
 *                 return -1             # <<<<<<<<<<<<<<
 *             if self_var > other_var:
 *                 return 1
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_neg_1);
      __pyx_r = __pyx_int_neg_1;
      goto __pyx_L0;

      /* "mathics/core/expression.py":684
 *             self_var, self_exp = self_exps[index]
 *             other_var, other_exp = other_exps[index]
 *             if self_var < other_var:             # <<<<<<<<<<<<<<
 *                 return -1
 *             if self_var > other_var:
 */
    }

    /* "mathics/core/expression.py":686
 *             if self_var < other_var:
 *                 return -1
 *             if self_var > other_var:             # <<<<<<<<<<<<<<
 *                 return 1
 *             if self_exp != other_exp:
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_self_var, __pyx_v_other_var, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 686, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 686, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":687
 *                 return -1
 *             if self_var > other_var:
 *                 return 1             # <<<<<<<<<<<<<<
 *             if self_exp != other_exp:
 *                 if index + 1 == self_len or index + 1 == other_len:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_int_1);
      __pyx_r = __pyx_int_1;
      goto __pyx_L0;

      /* "mathics/core/expression.py":686
 *             if self_var < other_var:
 *                 return -1
 *             if self_var > other_var:             # <<<<<<<<<<<<<<
 *                 return 1
 *             if self_exp != other_exp:
 */
    }

    /* "mathics/core/expression.py":688
 *             if self_var > other_var:
 *                 return 1
 *             if self_exp != other_exp:             # <<<<<<<<<<<<<<
 *                 if index + 1 == self_len or index + 1 == other_len:
 *                     # smaller exponents first
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_self_exp, __pyx_v_other_exp, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 688, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":689
 *                 return 1
 *             if self_exp != other_exp:
 *                 if index + 1 == self_len or index + 1 == other_len:             # <<<<<<<<<<<<<<
 *                     # smaller exponents first
 *                     if self_exp < other_exp:
 */
      __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!__pyx_t_6) {
      } else {
        __pyx_t_7 = __pyx_t_6;
        goto __pyx_L23_bool_binop_done;
      }
      __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_other_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_8, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __pyx_t_6;
      __pyx_L23_bool_binop_done:;
      if (__pyx_t_7) {

        /* "mathics/core/expression.py":691
 *                 if index + 1 == self_len or index + 1 == other_len:
 *                     # smaller exponents first
 *                     if self_exp < other_exp:             # <<<<<<<<<<<<<<
 *                         return -1
 *                     elif self_exp == other_exp:
 */
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_self_exp, __pyx_v_other_exp, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 691, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 691, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_7) {

          /* "mathics/core/expression.py":692
 *                     # smaller exponents first
 *                     if self_exp < other_exp:
 *                         return -1             # <<<<<<<<<<<<<<
 *                     elif self_exp == other_exp:
 *                         return 0
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_int_neg_1);
          __pyx_r = __pyx_int_neg_1;
          goto __pyx_L0;

          /* "mathics/core/expression.py":691
 *                 if index + 1 == self_len or index + 1 == other_len:
 *                     # smaller exponents first
 *                     if self_exp < other_exp:             # <<<<<<<<<<<<<<
 *                         return -1
 *                     elif self_exp == other_exp:
 */
        }

        /* "mathics/core/expression.py":693
 *                     if self_exp < other_exp:
 *                         return -1
 *                     elif self_exp == other_exp:             # <<<<<<<<<<<<<<
 *                         return 0
 *                     else:
 */
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_self_exp, __pyx_v_other_exp, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 693, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_7) {

          /* "mathics/core/expression.py":694
 *                         return -1
 *                     elif self_exp == other_exp:
 *                         return 0             # <<<<<<<<<<<<<<
 *                     else:
 *                         return 1
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_int_0);
          __pyx_r = __pyx_int_0;
          goto __pyx_L0;

          /* "mathics/core/expression.py":693
 *                     if self_exp < other_exp:
 *                         return -1
 *                     elif self_exp == other_exp:             # <<<<<<<<<<<<<<
 *                         return 0
 *                     else:
 */
        }

        /* "mathics/core/expression.py":696
 *                         return 0
 *                     else:
 *                         return 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # bigger exponents first
 */
        /*else*/ {
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_int_1);
          __pyx_r = __pyx_int_1;
          goto __pyx_L0;
        }

        /* "mathics/core/expression.py":689
 *                 return 1
 *             if self_exp != other_exp:
 *                 if index + 1 == self_len or index + 1 == other_len:             # <<<<<<<<<<<<<<
 *                     # smaller exponents first
 *                     if self_exp < other_exp:
 */
      }

      /* "mathics/core/expression.py":699
 *                 else:
 *                     # bigger exponents first
 *                     if self_exp < other_exp:             # <<<<<<<<<<<<<<
 *                         return 1
 *                     elif self_exp == other_exp:
 */
      /*else*/ {
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_self_exp, __pyx_v_other_exp, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 699, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_7) {

          /* "mathics/core/expression.py":700
 *                     # bigger exponents first
 *                     if self_exp < other_exp:
 *                         return 1             # <<<<<<<<<<<<<<
 *                     elif self_exp == other_exp:
 *                         return 0
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_int_1);
          __pyx_r = __pyx_int_1;
          goto __pyx_L0;

          /* "mathics/core/expression.py":699
 *                 else:
 *                     # bigger exponents first
 *                     if self_exp < other_exp:             # <<<<<<<<<<<<<<
 *                         return 1
 *                     elif self_exp == other_exp:
 */
        }

        /* "mathics/core/expression.py":701
 *                     if self_exp < other_exp:
 *                         return 1
 *                     elif self_exp == other_exp:             # <<<<<<<<<<<<<<
 *                         return 0
 *                     else:
 */
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_self_exp, __pyx_v_other_exp, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 701, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_7) {

          /* "mathics/core/expression.py":702
 *                         return 1
 *                     elif self_exp == other_exp:
 *                         return 0             # <<<<<<<<<<<<<<
 *                     else:
 *                         return -1
 */
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_int_0);
          __pyx_r = __pyx_int_0;
          goto __pyx_L0;

          /* "mathics/core/expression.py":701
 *                     if self_exp < other_exp:
 *                         return 1
 *                     elif self_exp == other_exp:             # <<<<<<<<<<<<<<
 *                         return 0
 *                     else:
 */
        }

        /* "mathics/core/expression.py":704
 *                         return 0
 *                     else:
 *                         return -1             # <<<<<<<<<<<<<<
 *             index += 1
 *         return 0
 */
        /*else*/ {
          __Pyx_XDECREF(__pyx_r);
          __Pyx_INCREF(__pyx_int_neg_1);
          __pyx_r = __pyx_int_neg_1;
          goto __pyx_L0;
        }
      }

      /* "mathics/core/expression.py":688
 *             if self_var > other_var:
 *                 return 1
 *             if self_exp != other_exp:             # <<<<<<<<<<<<<<
 *                 if index + 1 == self_len or index + 1 == other_len:
 *                     # smaller exponents first
 */
    }

    /* "mathics/core/expression.py":705
 *                     else:
 *                         return -1
 *             index += 1             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "mathics/core/expression.py":706
 *                         return -1
 *             index += 1
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_int_0);
  __pyx_r = __pyx_int_0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":657
 *         return self.__cmp(other) != 0
 * 
 *     def __cmp(self, other) -> int:             # <<<<<<<<<<<<<<
 *         self_exps = self.exps.copy()
 *         other_exps = other.exps.copy()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.core.expression.Monomial.__cmp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_var);
  __Pyx_XDECREF(__pyx_v_dec);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_self_var);
  __Pyx_XDECREF(__pyx_v_self_exp);
  __Pyx_XDECREF(__pyx_v_other_var);
  __Pyx_XDECREF(__pyx_v_other_exp);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":714
 *     _sequences: Any
 * 
 *     def __new__(cls, head, *leaves, **kwargs) -> "Expression":             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if isinstance(head, str):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_head = 0;
  PyObject *__pyx_v_leaves = 0;
  CYTHON_UNUSED 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("__new__ (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_leaves = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_leaves)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_leaves);
  } else {
    __pyx_v_leaves = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_head,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_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_head)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 2, 1); __PYX_ERR(0, 714, __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, "__new__") < 0)) __PYX_ERR(0, 714, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_cls = values[0];
    __pyx_v_head = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 714, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_CLEAR(__pyx_v_leaves);
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.Expression.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression___new__(__pyx_self, __pyx_v_cls, __pyx_v_head, __pyx_v_leaves, __pyx_v_kwargs);

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

/* "mathics/core/expression.py":719
 *             head = Symbol(head)
 *         self._head = head
 *         self._leaves = tuple(from_python(leaf) for leaf in leaves)             # <<<<<<<<<<<<<<
 *         self._sequences = None
 *         self._format_cache = None
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_7__new___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_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_7mathics_4core_10expression___pyx_scope_struct_7_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_7_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_7_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 719, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *) __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_7mathics_4core_10expression_10Expression_7__new___2generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Expression___new___locals_genexp, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.__new__.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_7mathics_4core_10expression_10Expression_7__new___2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 719, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_leaves)) { __Pyx_RaiseClosureNameError("leaves"); __PYX_ERR(0, 719, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_leaves == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 719, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_leaves; __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, 719, __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, 719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_leaf);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_leaf, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_from_python); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_cur_scope->__pyx_v_leaf) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_leaf);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_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, 719, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_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;
}

/* "mathics/core/expression.py":714
 *     _sequences: Any
 * 
 *     def __new__(cls, head, *leaves, **kwargs) -> "Expression":             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if isinstance(head, str):
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_head, PyObject *__pyx_v_leaves, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *__pyx_cur_scope;
  PyObject *__pyx_v_self = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_6___new__(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_6___new__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 714, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_leaves = __pyx_v_leaves;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_leaves);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_leaves);
  __Pyx_INCREF(__pyx_v_head);

  /* "mathics/core/expression.py":715
 * 
 *     def __new__(cls, head, *leaves, **kwargs) -> "Expression":
 *         self = super().__new__(cls)             # <<<<<<<<<<<<<<
 *         if isinstance(head, str):
 *             head = Symbol(head)
 */
  __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 715, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_cls);
  __Pyx_GIVEREF(__pyx_v_cls);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cls);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_cls) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cls);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":716
 *     def __new__(cls, head, *leaves, **kwargs) -> "Expression":
 *         self = super().__new__(cls)
 *         if isinstance(head, str):             # <<<<<<<<<<<<<<
 *             head = Symbol(head)
 *         self._head = head
 */
  __pyx_t_4 = PyUnicode_Check(__pyx_v_head); 
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":717
 *         self = super().__new__(cls)
 *         if isinstance(head, str):
 *             head = Symbol(head)             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._leaves = tuple(from_python(leaf) for leaf in leaves)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_head);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_head, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":716
 *     def __new__(cls, head, *leaves, **kwargs) -> "Expression":
 *         self = super().__new__(cls)
 *         if isinstance(head, str):             # <<<<<<<<<<<<<<
 *             head = Symbol(head)
 *         self._head = head
 */
  }

  /* "mathics/core/expression.py":718
 *         if isinstance(head, str):
 *             head = Symbol(head)
 *         self._head = head             # <<<<<<<<<<<<<<
 *         self._leaves = tuple(from_python(leaf) for leaf in leaves)
 *         self._sequences = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_head_2, __pyx_v_head) < 0) __PYX_ERR(0, 718, __pyx_L1_error)

  /* "mathics/core/expression.py":719
 *             head = Symbol(head)
 *         self._head = head
 *         self._leaves = tuple(from_python(leaf) for leaf in leaves)             # <<<<<<<<<<<<<<
 *         self._sequences = None
 *         self._format_cache = None
 */
  __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_10Expression_7__new___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2, __pyx_t_3) < 0) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":720
 *         self._head = head
 *         self._leaves = tuple(from_python(leaf) for leaf in leaves)
 *         self._sequences = None             # <<<<<<<<<<<<<<
 *         self._format_cache = None
 *         return self
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sequences_2, Py_None) < 0) __PYX_ERR(0, 720, __pyx_L1_error)

  /* "mathics/core/expression.py":721
 *         self._leaves = tuple(from_python(leaf) for leaf in leaves)
 *         self._sequences = None
 *         self._format_cache = None             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_format_cache, Py_None) < 0) __PYX_ERR(0, 721, __pyx_L1_error)

  /* "mathics/core/expression.py":722
 *         self._sequences = None
 *         self._format_cache = None
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":714
 *     _sequences: Any
 * 
 *     def __new__(cls, head, *leaves, **kwargs) -> "Expression":             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if isinstance(head, str):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Expression.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_head);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":725
 * 
 *     @property
 *     def head(self):             # <<<<<<<<<<<<<<
 *         return self._head
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_3head(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_3head = {"head", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_3head, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_3head(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("head (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_2head(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":726
 *     @property
 *     def head(self):
 *         return self._head             # <<<<<<<<<<<<<<
 * 
 *     @head.setter
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":725
 * 
 *     @property
 *     def head(self):             # <<<<<<<<<<<<<<
 *         return self._head
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Expression.head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":729
 * 
 *     @head.setter
 *     def head(self, value):             # <<<<<<<<<<<<<<
 *         raise ValueError("Expression.head is write protected.")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_5head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_5head = {"head", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_5head, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_5head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("head (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,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_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("head", 1, 2, 2, 1); __PYX_ERR(0, 729, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "head") < 0)) __PYX_ERR(0, 729, __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_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("head", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 729, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_4head(__pyx_self, __pyx_v_self, __pyx_v_value);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_4head(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
  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("head", 0);

  /* "mathics/core/expression.py":730
 *     @head.setter
 *     def head(self, value):
 *         raise ValueError("Expression.head is write protected.")             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 730, __pyx_L1_error)

  /* "mathics/core/expression.py":729
 * 
 *     @head.setter
 *     def head(self, value):             # <<<<<<<<<<<<<<
 *         raise ValueError("Expression.head is write protected.")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Expression.head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":733
 * 
 *     @property
 *     def leaves(self):             # <<<<<<<<<<<<<<
 *         return self._leaves
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_7leaves(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_7leaves = {"leaves", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_7leaves, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_7leaves(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("leaves (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_6leaves(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":734
 *     @property
 *     def leaves(self):
 *         return self._leaves             # <<<<<<<<<<<<<<
 * 
 *     @leaves.setter
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":733
 * 
 *     @property
 *     def leaves(self):             # <<<<<<<<<<<<<<
 *         return self._leaves
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Expression.leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":737
 * 
 *     @leaves.setter
 *     def leaves(self, value):             # <<<<<<<<<<<<<<
 *         raise ValueError("Expression.leaves is write protected.")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_9leaves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_9leaves = {"leaves", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_9leaves, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_9leaves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("leaves (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,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_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("leaves", 1, 2, 2, 1); __PYX_ERR(0, 737, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "leaves") < 0)) __PYX_ERR(0, 737, __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_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("leaves", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 737, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_8leaves(__pyx_self, __pyx_v_self, __pyx_v_value);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_8leaves(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
  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("leaves", 0);

  /* "mathics/core/expression.py":738
 *     @leaves.setter
 *     def leaves(self, value):
 *         raise ValueError("Expression.leaves is write protected.")             # <<<<<<<<<<<<<<
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(0, 738, __pyx_L1_error)

  /* "mathics/core/expression.py":737
 * 
 *     @leaves.setter
 *     def leaves(self, value):             # <<<<<<<<<<<<<<
 *         raise ValueError("Expression.leaves is write protected.")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Expression.leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":740
 *         raise ValueError("Expression.leaves is write protected.")
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_11equal2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_10Expression_10equal2[] = "Mathics two-argument Equal (==)\n        returns True if self and rhs are identical.\n        ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_11equal2 = {"equal2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_11equal2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_10Expression_10equal2};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_11equal2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_rhs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("equal2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rhs,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_rhs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("equal2", 1, 2, 2, 1); __PYX_ERR(0, 740, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "equal2") < 0)) __PYX_ERR(0, 740, __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_rhs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("equal2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 740, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.equal2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_10equal2(__pyx_self, __pyx_v_self, __pyx_v_rhs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_10equal2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) {
  PyObject *__pyx_v_equal_heads = NULL;
  PyObject *__pyx_v_item1 = NULL;
  PyObject *__pyx_v_item2 = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("equal2", 0);

  /* "mathics/core/expression.py":744
 *         returns True if self and rhs are identical.
 *         """
 *         if self.sameQ(rhs):             # <<<<<<<<<<<<<<
 *             return True
 *         # if rhs is an Atom, return None
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 744, __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_rhs) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_rhs);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 744, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":745
 *         """
 *         if self.sameQ(rhs):
 *             return True             # <<<<<<<<<<<<<<
 *         # if rhs is an Atom, return None
 *         elif isinstance(rhs, Atom):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":744
 *         returns True if self and rhs are identical.
 *         """
 *         if self.sameQ(rhs):             # <<<<<<<<<<<<<<
 *             return True
 *         # if rhs is an Atom, return None
 */
  }

  /* "mathics/core/expression.py":747
 *             return True
 *         # if rhs is an Atom, return None
 *         elif isinstance(rhs, Atom):             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Atom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_IsInstance(__pyx_v_rhs, __pyx_t_1); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 747, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":748
 *         # if rhs is an Atom, return None
 *         elif isinstance(rhs, Atom):
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         # Here we only need to deal with Expressions.
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/core/expression.py":747
 *             return True
 *         # if rhs is an Atom, return None
 *         elif isinstance(rhs, Atom):             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  }

  /* "mathics/core/expression.py":751
 * 
 *         # Here we only need to deal with Expressions.
 *         equal_heads = self._head.equal2(rhs._head)             # <<<<<<<<<<<<<<
 *         if not equal_heads:
 *             return equal_heads
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_equal2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_rhs, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_equal_heads = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":752
 *         # Here we only need to deal with Expressions.
 *         equal_heads = self._head.equal2(rhs._head)
 *         if not equal_heads:             # <<<<<<<<<<<<<<
 *             return equal_heads
 *         # From here, we can assume that both heads are the same
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_equal_heads); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 752, __pyx_L1_error)
  __pyx_t_4 = ((!__pyx_t_5) != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":753
 *         equal_heads = self._head.equal2(rhs._head)
 *         if not equal_heads:
 *             return equal_heads             # <<<<<<<<<<<<<<
 *         # From here, we can assume that both heads are the same
 *         if self.get_head_name() in ("System`List", "System`Sequence"):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_equal_heads);
    __pyx_r = __pyx_v_equal_heads;
    goto __pyx_L0;

    /* "mathics/core/expression.py":752
 *         # Here we only need to deal with Expressions.
 *         equal_heads = self._head.equal2(rhs._head)
 *         if not equal_heads:             # <<<<<<<<<<<<<<
 *             return equal_heads
 *         # From here, we can assume that both heads are the same
 */
  }

  /* "mathics/core/expression.py":755
 *             return equal_heads
 *         # From here, we can assume that both heads are the same
 *         if self.get_head_name() in ("System`List", "System`Sequence"):             # <<<<<<<<<<<<<<
 *             if len(self._leaves) != len(rhs._leaves):
 *                 return False
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_List, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 755, __pyx_L1_error)
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_Sequence, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 755, __pyx_L1_error)
  __pyx_t_4 = __pyx_t_5;
  __pyx_L6_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":756
 *         # From here, we can assume that both heads are the same
 *         if self.get_head_name() in ("System`List", "System`Sequence"):
 *             if len(self._leaves) != len(rhs._leaves):             # <<<<<<<<<<<<<<
 *                 return False
 *             for item1, item2 in zip(self._leaves, rhs._leaves):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rhs, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = ((__pyx_t_7 != __pyx_t_8) != 0);
    if (__pyx_t_5) {

      /* "mathics/core/expression.py":757
 *         if self.get_head_name() in ("System`List", "System`Sequence"):
 *             if len(self._leaves) != len(rhs._leaves):
 *                 return False             # <<<<<<<<<<<<<<
 *             for item1, item2 in zip(self._leaves, rhs._leaves):
 *                 result = item1.equal2(item2)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;

      /* "mathics/core/expression.py":756
 *         # From here, we can assume that both heads are the same
 *         if self.get_head_name() in ("System`List", "System`Sequence"):
 *             if len(self._leaves) != len(rhs._leaves):             # <<<<<<<<<<<<<<
 *                 return False
 *             for item1, item2 in zip(self._leaves, rhs._leaves):
 */
    }

    /* "mathics/core/expression.py":758
 *             if len(self._leaves) != len(rhs._leaves):
 *                 return False
 *             for item1, item2 in zip(self._leaves, rhs._leaves):             # <<<<<<<<<<<<<<
 *                 result = item1.equal2(item2)
 *                 if not result:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_rhs, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __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_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 758, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 758, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 758, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_9(__pyx_t_2);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 758, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        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, 758, __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_6 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        #else
        __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 758, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 758, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
        index = 0; __pyx_t_1 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_1);
        index = 1; __pyx_t_6 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(0, 758, __pyx_L1_error)
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 758, __pyx_L1_error)
        __pyx_L12_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_item1, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_item2, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "mathics/core/expression.py":759
 *                 return False
 *             for item1, item2 in zip(self._leaves, rhs._leaves):
 *                 result = item1.equal2(item2)             # <<<<<<<<<<<<<<
 *                 if not result:
 *                     return result
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_item1, __pyx_n_s_equal2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 759, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_v_item2) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_item2);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 759, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":760
 *             for item1, item2 in zip(self._leaves, rhs._leaves):
 *                 result = item1.equal2(item2)
 *                 if not result:             # <<<<<<<<<<<<<<
 *                     return result
 *             return True
 */
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_result); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 760, __pyx_L1_error)
      __pyx_t_4 = ((!__pyx_t_5) != 0);
      if (__pyx_t_4) {

        /* "mathics/core/expression.py":761
 *                 result = item1.equal2(item2)
 *                 if not result:
 *                     return result             # <<<<<<<<<<<<<<
 *             return True
 *         elif self.get_head_name() in ("System`DirectedInfinity",):
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_result);
        __pyx_r = __pyx_v_result;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":760
 *             for item1, item2 in zip(self._leaves, rhs._leaves):
 *                 result = item1.equal2(item2)
 *                 if not result:             # <<<<<<<<<<<<<<
 *                     return result
 *             return True
 */
      }

      /* "mathics/core/expression.py":758
 *             if len(self._leaves) != len(rhs._leaves):
 *                 return False
 *             for item1, item2 in zip(self._leaves, rhs._leaves):             # <<<<<<<<<<<<<<
 *                 result = item1.equal2(item2)
 *                 if not result:
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mathics/core/expression.py":762
 *                 if not result:
 *                     return result
 *             return True             # <<<<<<<<<<<<<<
 *         elif self.get_head_name() in ("System`DirectedInfinity",):
 *             return self._leaves[0].equal2(rhs._leaves[0])
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":755
 *             return equal_heads
 *         # From here, we can assume that both heads are the same
 *         if self.get_head_name() in ("System`List", "System`Sequence"):             # <<<<<<<<<<<<<<
 *             if len(self._leaves) != len(rhs._leaves):
 *                 return False
 */
  }

  /* "mathics/core/expression.py":763
 *                     return result
 *             return True
 *         elif self.get_head_name() in ("System`DirectedInfinity",):             # <<<<<<<<<<<<<<
 *             return self._leaves[0].equal2(rhs._leaves[0])
 *         return None
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_DirectedInfinity, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 763, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":764
 *             return True
 *         elif self.get_head_name() in ("System`DirectedInfinity",):
 *             return self._leaves[0].equal2(rhs._leaves[0])             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_equal2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_rhs, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":763
 *                     return result
 *             return True
 *         elif self.get_head_name() in ("System`DirectedInfinity",):             # <<<<<<<<<<<<<<
 *             return self._leaves[0].equal2(rhs._leaves[0])
 *         return None
 */
  }

  /* "mathics/core/expression.py":765
 *         elif self.get_head_name() in ("System`DirectedInfinity",):
 *             return self._leaves[0].equal2(rhs._leaves[0])
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def slice(self, head, py_slice, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":740
 *         raise ValueError("Expression.leaves is write protected.")
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.Expression.equal2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_equal_heads);
  __Pyx_XDECREF(__pyx_v_item1);
  __Pyx_XDECREF(__pyx_v_item2);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":767
 *         return None
 * 
 *     def slice(self, head, py_slice, evaluation):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, *self.leaves[py_slice])
 *         return structure(head, self, evaluation).slice(self, py_slice)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_13slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_13slice = {"slice", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_13slice, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_13slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_head = 0;
  PyObject *__pyx_v_py_slice = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("slice (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_head,&__pyx_n_s_py_slice,&__pyx_n_s_evaluation,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_head)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slice", 1, 4, 4, 1); __PYX_ERR(0, 767, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_slice)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slice", 1, 4, 4, 2); __PYX_ERR(0, 767, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slice", 1, 4, 4, 3); __PYX_ERR(0, 767, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "slice") < 0)) __PYX_ERR(0, 767, __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_head = values[1];
    __pyx_v_py_slice = values[2];
    __pyx_v_evaluation = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("slice", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 767, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_12slice(__pyx_self, __pyx_v_self, __pyx_v_head, __pyx_v_py_slice, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_12slice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head, PyObject *__pyx_v_py_slice, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("slice", 0);

  /* "mathics/core/expression.py":769
 *     def slice(self, head, py_slice, evaluation):
 *         # faster equivalent to: Expression(head, *self.leaves[py_slice])
 *         return structure(head, self, evaluation).slice(self, py_slice)             # <<<<<<<<<<<<<<
 * 
 *     def filter(self, head, cond, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_structure); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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[4] = {__pyx_t_4, __pyx_v_head, __pyx_v_self, __pyx_v_evaluation};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 769, __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[4] = {__pyx_t_4, __pyx_v_head, __pyx_v_self, __pyx_v_evaluation};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 769, __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_head);
    __Pyx_GIVEREF(__pyx_v_head);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_head);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_evaluation);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 769, __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_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_slice); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_5 = 0;
  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_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self, __pyx_v_py_slice};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self, __pyx_v_py_slice};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_py_slice);
    __Pyx_GIVEREF(__pyx_v_py_slice);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_py_slice);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":767
 *         return None
 * 
 *     def slice(self, head, py_slice, evaluation):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, *self.leaves[py_slice])
 *         return structure(head, self, evaluation).slice(self, py_slice)
 */

  /* 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("mathics.core.expression.Expression.slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":771
 *         return structure(head, self, evaluation).slice(self, py_slice)
 * 
 *     def filter(self, head, cond, evaluation):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, [leaf in self.leaves if cond(leaf)])
 *         return structure(head, self, evaluation).filter(self, cond)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_15filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_15filter = {"filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_15filter, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_15filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_head = 0;
  PyObject *__pyx_v_cond = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_head,&__pyx_n_s_cond,&__pyx_n_s_evaluation,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_head)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter", 1, 4, 4, 1); __PYX_ERR(0, 771, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cond)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter", 1, 4, 4, 2); __PYX_ERR(0, 771, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter", 1, 4, 4, 3); __PYX_ERR(0, 771, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filter") < 0)) __PYX_ERR(0, 771, __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_head = values[1];
    __pyx_v_cond = values[2];
    __pyx_v_evaluation = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 771, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_14filter(__pyx_self, __pyx_v_self, __pyx_v_head, __pyx_v_cond, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_14filter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head, PyObject *__pyx_v_cond, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter", 0);

  /* "mathics/core/expression.py":773
 *     def filter(self, head, cond, evaluation):
 *         # faster equivalent to: Expression(head, [leaf in self.leaves if cond(leaf)])
 *         return structure(head, self, evaluation).filter(self, cond)             # <<<<<<<<<<<<<<
 * 
 *     def restructure(self, head, leaves, evaluation, structure_cache=None, deps=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_structure); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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[4] = {__pyx_t_4, __pyx_v_head, __pyx_v_self, __pyx_v_evaluation};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __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[4] = {__pyx_t_4, __pyx_v_head, __pyx_v_self, __pyx_v_evaluation};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 773, __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_head);
    __Pyx_GIVEREF(__pyx_v_head);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_head);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_evaluation);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __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_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_filter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_5 = 0;
  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_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self, __pyx_v_cond};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self, __pyx_v_cond};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 773, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_cond);
    __Pyx_GIVEREF(__pyx_v_cond);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_cond);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":771
 *         return structure(head, self, evaluation).slice(self, py_slice)
 * 
 *     def filter(self, head, cond, evaluation):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, [leaf in self.leaves if cond(leaf)])
 *         return structure(head, self, evaluation).filter(self, cond)
 */

  /* 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("mathics.core.expression.Expression.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":775
 *         return structure(head, self, evaluation).filter(self, cond)
 * 
 *     def restructure(self, head, leaves, evaluation, structure_cache=None, deps=None):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, *leaves)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_17restructure(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_17restructure = {"restructure", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_17restructure, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_17restructure(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_head = 0;
  PyObject *__pyx_v_leaves = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_structure_cache = 0;
  PyObject *__pyx_v_deps = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("restructure (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_head,&__pyx_n_s_leaves,&__pyx_n_s_evaluation,&__pyx_n_s_structure_cache,&__pyx_n_s_deps,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_head)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("restructure", 0, 4, 6, 1); __PYX_ERR(0, 775, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_leaves)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("restructure", 0, 4, 6, 2); __PYX_ERR(0, 775, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("restructure", 0, 4, 6, 3); __PYX_ERR(0, 775, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_structure_cache);
          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_deps);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "restructure") < 0)) __PYX_ERR(0, 775, __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_self = values[0];
    __pyx_v_head = values[1];
    __pyx_v_leaves = values[2];
    __pyx_v_evaluation = values[3];
    __pyx_v_structure_cache = values[4];
    __pyx_v_deps = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("restructure", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 775, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.restructure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_16restructure(__pyx_self, __pyx_v_self, __pyx_v_head, __pyx_v_leaves, __pyx_v_evaluation, __pyx_v_structure_cache, __pyx_v_deps);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_16restructure(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head, PyObject *__pyx_v_leaves, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_structure_cache, PyObject *__pyx_v_deps) {
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  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("restructure", 0);
  __Pyx_INCREF(__pyx_v_deps);

  /* "mathics/core/expression.py":786
 *         # may be passed an initially empty dict to speed up calls.
 * 
 *         if deps is None:             # <<<<<<<<<<<<<<
 *             deps = self
 *         s = structure(head, deps, evaluation, structure_cache=structure_cache)
 */
  __pyx_t_1 = (__pyx_v_deps == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":787
 * 
 *         if deps is None:
 *             deps = self             # <<<<<<<<<<<<<<
 *         s = structure(head, deps, evaluation, structure_cache=structure_cache)
 *         return s(list(leaves))
 */
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_DECREF_SET(__pyx_v_deps, __pyx_v_self);

    /* "mathics/core/expression.py":786
 *         # may be passed an initially empty dict to speed up calls.
 * 
 *         if deps is None:             # <<<<<<<<<<<<<<
 *             deps = self
 *         s = structure(head, deps, evaluation, structure_cache=structure_cache)
 */
  }

  /* "mathics/core/expression.py":788
 *         if deps is None:
 *             deps = self
 *         s = structure(head, deps, evaluation, structure_cache=structure_cache)             # <<<<<<<<<<<<<<
 *         return s(list(leaves))
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_structure); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_head);
  __Pyx_GIVEREF(__pyx_v_head);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_head);
  __Pyx_INCREF(__pyx_v_deps);
  __Pyx_GIVEREF(__pyx_v_deps);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_deps);
  __Pyx_INCREF(__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_v_evaluation);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_evaluation);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_structure_cache, __pyx_v_structure_cache) < 0) __PYX_ERR(0, 788, __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, 788, __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;
  __pyx_v_s = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "mathics/core/expression.py":789
 *             deps = self
 *         s = structure(head, deps, evaluation, structure_cache=structure_cache)
 *         return s(list(leaves))             # <<<<<<<<<<<<<<
 * 
 *     def _no_symbol(self, symbol_name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PySequence_List(__pyx_v_leaves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_s);
  __pyx_t_4 = __pyx_v_s; __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_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":775
 *         return structure(head, self, evaluation).filter(self, cond)
 * 
 *     def restructure(self, head, leaves, evaluation, structure_cache=None, deps=None):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, *leaves)
 * 
 */

  /* 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("mathics.core.expression.Expression.restructure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_deps);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":791
 *         return s(list(leaves))
 * 
 *     def _no_symbol(self, symbol_name):             # <<<<<<<<<<<<<<
 *         # if this return True, it's safe to say that self.leaves or its
 *         # sub leaves contain no Symbol with symbol_name. if this returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_19_no_symbol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_19_no_symbol = {"_no_symbol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_19_no_symbol, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_19_no_symbol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_symbol_name = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_no_symbol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_symbol_name,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_symbol_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_no_symbol", 1, 2, 2, 1); __PYX_ERR(0, 791, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_no_symbol") < 0)) __PYX_ERR(0, 791, __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_symbol_name = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_no_symbol", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 791, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression._no_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_18_no_symbol(__pyx_self, __pyx_v_self, __pyx_v_symbol_name);

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

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

  /* "mathics/core/expression.py":796
 *         # False, such a Symbol might or might not exist.
 * 
 *         cache = self._cache             # <<<<<<<<<<<<<<
 *         if cache is None:
 *             return False
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cache = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":797
 * 
 *         cache = self._cache
 *         if cache is None:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_2 = (__pyx_v_cache == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":798
 *         cache = self._cache
 *         if cache is None:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         symbols = cache.symbols
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "mathics/core/expression.py":797
 * 
 *         cache = self._cache
 *         if cache is None:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  }

  /* "mathics/core/expression.py":800
 *             return False
 * 
 *         symbols = cache.symbols             # <<<<<<<<<<<<<<
 *         if symbols is not None and symbol_name not in symbols:
 *             return True
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_symbols = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":801
 * 
 *         symbols = cache.symbols
 *         if symbols is not None and symbol_name not in symbols:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  __pyx_t_2 = (__pyx_v_symbols != Py_None);
  __pyx_t_4 = (__pyx_t_2 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_symbol_name, __pyx_v_symbols, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 801, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_4 != 0);
  __pyx_t_3 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":802
 *         symbols = cache.symbols
 *         if symbols is not None and symbol_name not in symbols:
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":801
 * 
 *         symbols = cache.symbols
 *         if symbols is not None and symbol_name not in symbols:             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
  }

  /* "mathics/core/expression.py":804
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     def sequences(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":791
 *         return s(list(leaves))
 * 
 *     def _no_symbol(self, symbol_name):             # <<<<<<<<<<<<<<
 *         # if this return True, it's safe to say that self.leaves or its
 *         # sub leaves contain no Symbol with symbol_name. if this returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Expression._no_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache);
  __Pyx_XDECREF(__pyx_v_symbols);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":806
 *             return False
 * 
 *     def sequences(self):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 *         if cache:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_21sequences(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_21sequences = {"sequences", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_21sequences, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_21sequences(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sequences (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_20sequences(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":807
 * 
 *     def sequences(self):
 *         cache = self._cache             # <<<<<<<<<<<<<<
 *         if cache:
 *             seq = cache.sequences
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cache = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":808
 *     def sequences(self):
 *         cache = self._cache
 *         if cache:             # <<<<<<<<<<<<<<
 *             seq = cache.sequences
 *             if seq is not None:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_cache); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 808, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":809
 *         cache = self._cache
 *         if cache:
 *             seq = cache.sequences             # <<<<<<<<<<<<<<
 *             if seq is not None:
 *                 return seq
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_sequences); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 809, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_seq = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":810
 *         if cache:
 *             seq = cache.sequences
 *             if seq is not None:             # <<<<<<<<<<<<<<
 *                 return seq
 * 
 */
    __pyx_t_2 = (__pyx_v_seq != Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {

      /* "mathics/core/expression.py":811
 *             seq = cache.sequences
 *             if seq is not None:
 *                 return seq             # <<<<<<<<<<<<<<
 * 
 *         return self._rebuild_cache().sequences
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_seq);
      __pyx_r = __pyx_v_seq;
      goto __pyx_L0;

      /* "mathics/core/expression.py":810
 *         if cache:
 *             seq = cache.sequences
 *             if seq is not None:             # <<<<<<<<<<<<<<
 *                 return seq
 * 
 */
    }

    /* "mathics/core/expression.py":808
 *     def sequences(self):
 *         cache = self._cache
 *         if cache:             # <<<<<<<<<<<<<<
 *             seq = cache.sequences
 *             if seq is not None:
 */
  }

  /* "mathics/core/expression.py":813
 *                 return seq
 * 
 *         return self._rebuild_cache().sequences             # <<<<<<<<<<<<<<
 * 
 *     def _flatten_sequence(self, sequence, evaluation) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rebuild_cache); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sequences); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":806
 *             return False
 * 
 *     def sequences(self):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 *         if cache:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Expression.sequences", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache);
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":815
 *         return self._rebuild_cache().sequences
 * 
 *     def _flatten_sequence(self, sequence, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         indices = self.sequences()
 *         if not indices:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_23_flatten_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_23_flatten_sequence = {"_flatten_sequence", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_23_flatten_sequence, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_23_flatten_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_sequence = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_flatten_sequence (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_sequence,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sequence)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_flatten_sequence", 1, 3, 3, 1); __PYX_ERR(0, 815, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_flatten_sequence", 1, 3, 3, 2); __PYX_ERR(0, 815, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_flatten_sequence") < 0)) __PYX_ERR(0, 815, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_sequence = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_flatten_sequence", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 815, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression._flatten_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_22_flatten_sequence(__pyx_self, __pyx_v_self, __pyx_v_sequence, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_22_flatten_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_sequence, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_indices = NULL;
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_v_flattened = NULL;
  PyObject *__pyx_v_extend = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_flatten_sequence", 0);

  /* "mathics/core/expression.py":816
 * 
 *     def _flatten_sequence(self, sequence, evaluation) -> "Expression":
 *         indices = self.sequences()             # <<<<<<<<<<<<<<
 *         if not indices:
 *             return self
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sequences); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __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, 816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_indices = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":817
 *     def _flatten_sequence(self, sequence, evaluation) -> "Expression":
 *         indices = self.sequences()
 *         if not indices:             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_indices); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 817, __pyx_L1_error)
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":818
 *         indices = self.sequences()
 *         if not indices:
 *             return self             # <<<<<<<<<<<<<<
 * 
 *         leaves = self._leaves
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;

    /* "mathics/core/expression.py":817
 *     def _flatten_sequence(self, sequence, evaluation) -> "Expression":
 *         indices = self.sequences()
 *         if not indices:             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
  }

  /* "mathics/core/expression.py":820
 *             return self
 * 
 *         leaves = self._leaves             # <<<<<<<<<<<<<<
 * 
 *         flattened = []
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_leaves = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":822
 *         leaves = self._leaves
 * 
 *         flattened = []             # <<<<<<<<<<<<<<
 *         extend = flattened.extend
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_flattened = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":823
 * 
 *         flattened = []
 *         extend = flattened.extend             # <<<<<<<<<<<<<<
 * 
 *         k = 0
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_flattened, __pyx_n_s_extend); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_extend = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":825
 *         extend = flattened.extend
 * 
 *         k = 0             # <<<<<<<<<<<<<<
 *         for i in indices:
 *             extend(leaves[k:i])
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_k = __pyx_int_0;

  /* "mathics/core/expression.py":826
 * 
 *         k = 0
 *         for i in indices:             # <<<<<<<<<<<<<<
 *             extend(leaves[k:i])
 *             extend(sequence(leaves[i]))
 */
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 826, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 826, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 826, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 826, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":827
 *         k = 0
 *         for i in indices:
 *             extend(leaves[k:i])             # <<<<<<<<<<<<<<
 *             extend(sequence(leaves[i]))
 *             k = i + 1
 */
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_leaves, 0, 0, &__pyx_v_k, &__pyx_v_i, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_extend);
    __pyx_t_8 = __pyx_v_extend; __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_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mathics/core/expression.py":828
 *         for i in indices:
 *             extend(leaves[k:i])
 *             extend(sequence(leaves[i]))             # <<<<<<<<<<<<<<
 *             k = i + 1
 *         extend(leaves[k:])
 */
    __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_leaves, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_sequence);
    __pyx_t_9 = __pyx_v_sequence; __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_INCREF(__pyx_v_extend);
    __pyx_t_9 = __pyx_v_extend; __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mathics/core/expression.py":829
 *             extend(leaves[k:i])
 *             extend(sequence(leaves[i]))
 *             k = i + 1             # <<<<<<<<<<<<<<
 *         extend(leaves[k:])
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":826
 * 
 *         k = 0
 *         for i in indices:             # <<<<<<<<<<<<<<
 *             extend(leaves[k:i])
 *             extend(sequence(leaves[i]))
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":830
 *             extend(sequence(leaves[i]))
 *             k = i + 1
 *         extend(leaves[k:])             # <<<<<<<<<<<<<<
 * 
 *         return self.restructure(self._head, flattened, evaluation)
 */
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_leaves, 0, 0, &__pyx_v_k, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_extend);
  __pyx_t_9 = __pyx_v_extend; __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 830, __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;

  /* "mathics/core/expression.py":832
 *         extend(leaves[k:])
 * 
 *         return self.restructure(self._head, flattened, evaluation)             # <<<<<<<<<<<<<<
 * 
 *     def flatten_sequence(self, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_restructure); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_2, __pyx_v_flattened, __pyx_v_evaluation};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_2, __pyx_v_flattened, __pyx_v_evaluation};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_t_2);
    __Pyx_INCREF(__pyx_v_flattened);
    __Pyx_GIVEREF(__pyx_v_flattened);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_v_flattened);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_11, __pyx_v_evaluation);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":815
 *         return self._rebuild_cache().sequences
 * 
 *     def _flatten_sequence(self, sequence, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         indices = self.sequences()
 *         if not indices:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.Expression._flatten_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_v_flattened);
  __Pyx_XDECREF(__pyx_v_extend);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":834
 *         return self.restructure(self._head, flattened, evaluation)
 * 
 *     def flatten_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             if leaf.get_head_name() == "System`Sequence":
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_25flatten_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_25flatten_sequence = {"flatten_sequence", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_25flatten_sequence, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_25flatten_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flatten_sequence (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("flatten_sequence", 1, 2, 2, 1); __PYX_ERR(0, 834, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flatten_sequence") < 0)) __PYX_ERR(0, 834, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("flatten_sequence", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 834, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.flatten_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_24flatten_sequence(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

/* "mathics/core/expression.py":835
 * 
 *     def flatten_sequence(self, evaluation):
 *         def sequence(leaf):             # <<<<<<<<<<<<<<
 *             if leaf.get_head_name() == "System`Sequence":
 *                 return leaf._leaves
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_16flatten_sequence_1sequence(PyObject *__pyx_self, PyObject *__pyx_v_leaf); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_16flatten_sequence_1sequence = {"sequence", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_16flatten_sequence_1sequence, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_16flatten_sequence_1sequence(PyObject *__pyx_self, PyObject *__pyx_v_leaf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sequence (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_16flatten_sequence_sequence(__pyx_self, ((PyObject *)__pyx_v_leaf));

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

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

  /* "mathics/core/expression.py":836
 *     def flatten_sequence(self, evaluation):
 *         def sequence(leaf):
 *             if leaf.get_head_name() == "System`Sequence":             # <<<<<<<<<<<<<<
 *                 return leaf._leaves
 *             else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __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, 836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_Sequence, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 836, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":837
 *         def sequence(leaf):
 *             if leaf.get_head_name() == "System`Sequence":
 *                 return leaf._leaves             # <<<<<<<<<<<<<<
 *             else:
 *                 return [leaf]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 837, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":836
 *     def flatten_sequence(self, evaluation):
 *         def sequence(leaf):
 *             if leaf.get_head_name() == "System`Sequence":             # <<<<<<<<<<<<<<
 *                 return leaf._leaves
 *             else:
 */
  }

  /* "mathics/core/expression.py":839
 *                 return leaf._leaves
 *             else:
 *                 return [leaf]             # <<<<<<<<<<<<<<
 * 
 *         return self._flatten_sequence(sequence, evaluation)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_leaf);
    __Pyx_GIVEREF(__pyx_v_leaf);
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_leaf);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":835
 * 
 *     def flatten_sequence(self, evaluation):
 *         def sequence(leaf):             # <<<<<<<<<<<<<<
 *             if leaf.get_head_name() == "System`Sequence":
 *                 return leaf._leaves
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Expression.flatten_sequence.sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":834
 *         return self.restructure(self._head, flattened, evaluation)
 * 
 *     def flatten_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             if leaf.get_head_name() == "System`Sequence":
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_24flatten_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_sequence = 0;
  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("flatten_sequence", 0);

  /* "mathics/core/expression.py":835
 * 
 *     def flatten_sequence(self, evaluation):
 *         def sequence(leaf):             # <<<<<<<<<<<<<<
 *             if leaf.get_head_name() == "System`Sequence":
 *                 return leaf._leaves
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_16flatten_sequence_1sequence, 0, __pyx_n_s_Expression_flatten_sequence_loca, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sequence = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":841
 *                 return [leaf]
 * 
 *         return self._flatten_sequence(sequence, evaluation)             # <<<<<<<<<<<<<<
 * 
 *     def flatten_pattern_sequence(self, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_flatten_sequence); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_sequence, __pyx_v_evaluation};
    __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, 841, __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_sequence, __pyx_v_evaluation};
    __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, 841, __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, 841, __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_sequence);
    __Pyx_GIVEREF(__pyx_v_sequence);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_sequence);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_evaluation);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __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;

  /* "mathics/core/expression.py":834
 *         return self.restructure(self._head, flattened, evaluation)
 * 
 *     def flatten_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             if leaf.get_head_name() == "System`Sequence":
 */

  /* 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("mathics.core.expression.Expression.flatten_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sequence);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":843
 *         return self._flatten_sequence(sequence, evaluation)
 * 
 *     def flatten_pattern_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_27flatten_pattern_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_27flatten_pattern_sequence = {"flatten_pattern_sequence", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_27flatten_pattern_sequence, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_27flatten_pattern_sequence(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flatten_pattern_sequence (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("flatten_pattern_sequence", 1, 2, 2, 1); __PYX_ERR(0, 843, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flatten_pattern_sequence") < 0)) __PYX_ERR(0, 843, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("flatten_pattern_sequence", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 843, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.flatten_pattern_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_26flatten_pattern_sequence(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

/* "mathics/core/expression.py":844
 * 
 *     def flatten_pattern_sequence(self, evaluation):
 *         def sequence(leaf):             # <<<<<<<<<<<<<<
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 *             if leaf.get_head_name() == "System`Sequence" and leaf.pattern_sequence:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_24flatten_pattern_sequence_1sequence(PyObject *__pyx_self, PyObject *__pyx_v_leaf); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_24flatten_pattern_sequence_1sequence = {"sequence", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_24flatten_pattern_sequence_1sequence, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_24flatten_pattern_sequence_1sequence(PyObject *__pyx_self, PyObject *__pyx_v_leaf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sequence (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_24flatten_pattern_sequence_sequence(__pyx_self, ((PyObject *)__pyx_v_leaf));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_24flatten_pattern_sequence_sequence(PyObject *__pyx_self, PyObject *__pyx_v_leaf) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *__pyx_cur_scope;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *__pyx_outer_scope;
  PyObject *__pyx_v_flattened = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sequence", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/core/expression.py":845
 *     def flatten_pattern_sequence(self, evaluation):
 *         def sequence(leaf):
 *             flattened = leaf.flatten_pattern_sequence(evaluation)             # <<<<<<<<<<<<<<
 *             if leaf.get_head_name() == "System`Sequence" and leaf.pattern_sequence:
 *                 return flattened._leaves
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_flatten_pattern_sequence); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 845, __pyx_L1_error) }
  __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_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_flattened = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":846
 *         def sequence(leaf):
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 *             if leaf.get_head_name() == "System`Sequence" and leaf.pattern_sequence:             # <<<<<<<<<<<<<<
 *                 return flattened._leaves
 *             else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 846, __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, 846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_Sequence, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 846, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_pattern_sequence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 846, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":847
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 *             if leaf.get_head_name() == "System`Sequence" and leaf.pattern_sequence:
 *                 return flattened._leaves             # <<<<<<<<<<<<<<
 *             else:
 *                 return [flattened]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_flattened, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 847, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":846
 *         def sequence(leaf):
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 *             if leaf.get_head_name() == "System`Sequence" and leaf.pattern_sequence:             # <<<<<<<<<<<<<<
 *                 return flattened._leaves
 *             else:
 */
  }

  /* "mathics/core/expression.py":849
 *                 return flattened._leaves
 *             else:
 *                 return [flattened]             # <<<<<<<<<<<<<<
 * 
 *         expr = self._flatten_sequence(sequence, evaluation)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 849, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_flattened);
    __Pyx_GIVEREF(__pyx_v_flattened);
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_flattened);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":844
 * 
 *     def flatten_pattern_sequence(self, evaluation):
 *         def sequence(leaf):             # <<<<<<<<<<<<<<
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 *             if leaf.get_head_name() == "System`Sequence" and leaf.pattern_sequence:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Expression.flatten_pattern_sequence.sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_flattened);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":843
 *         return self._flatten_sequence(sequence, evaluation)
 * 
 *     def flatten_pattern_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_26flatten_pattern_sequence(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *__pyx_cur_scope;
  PyObject *__pyx_v_sequence = 0;
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("flatten_pattern_sequence", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 843, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_evaluation = __pyx_v_evaluation;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);

  /* "mathics/core/expression.py":844
 * 
 *     def flatten_pattern_sequence(self, evaluation):
 *         def sequence(leaf):             # <<<<<<<<<<<<<<
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 *             if leaf.get_head_name() == "System`Sequence" and leaf.pattern_sequence:
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_24flatten_pattern_sequence_1sequence, 0, __pyx_n_s_Expression_flatten_pattern_seque, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sequence = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":851
 *                 return [flattened]
 * 
 *         expr = self._flatten_sequence(sequence, evaluation)             # <<<<<<<<<<<<<<
 *         if hasattr(self, "options"):
 *             expr.options = self.options
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_flatten_sequence); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  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_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_sequence, __pyx_cur_scope->__pyx_v_evaluation};
    __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, 851, __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_sequence, __pyx_cur_scope->__pyx_v_evaluation};
    __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, 851, __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, 851, __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_sequence);
    __Pyx_GIVEREF(__pyx_v_sequence);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_sequence);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_evaluation);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 851, __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_v_expr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":852
 * 
 *         expr = self._flatten_sequence(sequence, evaluation)
 *         if hasattr(self, "options"):             # <<<<<<<<<<<<<<
 *             expr.options = self.options
 *         return expr
 */
  __pyx_t_6 = __Pyx_HasAttr(__pyx_v_self, __pyx_n_u_options); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 852, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "mathics/core/expression.py":853
 *         expr = self._flatten_sequence(sequence, evaluation)
 *         if hasattr(self, "options"):
 *             expr.options = self.options             # <<<<<<<<<<<<<<
 *         return expr
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_options, __pyx_t_1) < 0) __PYX_ERR(0, 853, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":852
 * 
 *         expr = self._flatten_sequence(sequence, evaluation)
 *         if hasattr(self, "options"):             # <<<<<<<<<<<<<<
 *             expr.options = self.options
 *         return expr
 */
  }

  /* "mathics/core/expression.py":854
 *         if hasattr(self, "options"):
 *             expr.options = self.options
 *         return expr             # <<<<<<<<<<<<<<
 * 
 *     def _rebuild_cache(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "mathics/core/expression.py":843
 *         return self._flatten_sequence(sequence, evaluation)
 * 
 *     def flatten_pattern_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 */

  /* 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("mathics.core.expression.Expression.flatten_pattern_sequence", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sequence);
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":856
 *         return expr
 * 
 *     def _rebuild_cache(self):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_29_rebuild_cache(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_29_rebuild_cache = {"_rebuild_cache", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_29_rebuild_cache, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_29_rebuild_cache(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_rebuild_cache (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_28_rebuild_cache(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_28_rebuild_cache(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_cache = NULL;
  PyObject *__pyx_v_time = NULL;
  PyObject *__pyx_v_sym = NULL;
  PyObject *__pyx_v_seq = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_v_leaf_symbols = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_rebuild_cache", 0);

  /* "mathics/core/expression.py":857
 * 
 *     def _rebuild_cache(self):
 *         cache = self._cache             # <<<<<<<<<<<<<<
 * 
 *         if cache is None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cache = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":859
 *         cache = self._cache
 * 
 *         if cache is None:             # <<<<<<<<<<<<<<
 *             time = None
 *         elif cache.symbols is None:
 */
  __pyx_t_2 = (__pyx_v_cache == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":860
 * 
 *         if cache is None:
 *             time = None             # <<<<<<<<<<<<<<
 *         elif cache.symbols is None:
 *             time = cache.time
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_time = Py_None;

    /* "mathics/core/expression.py":859
 *         cache = self._cache
 * 
 *         if cache is None:             # <<<<<<<<<<<<<<
 *             time = None
 *         elif cache.symbols is None:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":861
 *         if cache is None:
 *             time = None
 *         elif cache.symbols is None:             # <<<<<<<<<<<<<<
 *             time = cache.time
 *         elif cache.sequences is None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":862
 *             time = None
 *         elif cache.symbols is None:
 *             time = cache.time             # <<<<<<<<<<<<<<
 *         elif cache.sequences is None:
 *             time = cache.time
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 862, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_time = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":861
 *         if cache is None:
 *             time = None
 *         elif cache.symbols is None:             # <<<<<<<<<<<<<<
 *             time = cache.time
 *         elif cache.sequences is None:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":863
 *         elif cache.symbols is None:
 *             time = cache.time
 *         elif cache.sequences is None:             # <<<<<<<<<<<<<<
 *             time = cache.time
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_sequences); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":864
 *             time = cache.time
 *         elif cache.sequences is None:
 *             time = cache.time             # <<<<<<<<<<<<<<
 *         else:
 *             return cache
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_time = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":863
 *         elif cache.symbols is None:
 *             time = cache.time
 *         elif cache.sequences is None:             # <<<<<<<<<<<<<<
 *             time = cache.time
 *         else:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":866
 *             time = cache.time
 *         else:
 *             return cache             # <<<<<<<<<<<<<<
 * 
 *         sym = set((self.get_head_name(),))
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_cache);
    __pyx_r = __pyx_v_cache;
    goto __pyx_L0;
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":868
 *             return cache
 * 
 *         sym = set((self.get_head_name(),))             # <<<<<<<<<<<<<<
 *         seq = []
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PySet_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PySet_Add(__pyx_t_4, __pyx_t_1) < 0) __PYX_ERR(0, 868, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_sym = __pyx_t_4;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":869
 * 
 *         sym = set((self.get_head_name(),))
 *         seq = []             # <<<<<<<<<<<<<<
 * 
 *         for i, leaf in enumerate(self._leaves):
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_seq = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "mathics/core/expression.py":871
 *         seq = []
 * 
 *         for i, leaf in enumerate(self._leaves):             # <<<<<<<<<<<<<<
 *             if isinstance(leaf, Expression):
 *                 leaf_symbols = leaf._rebuild_cache().symbols
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_4 = __pyx_int_0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 871, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 871, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 871, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 871, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_7(__pyx_t_5);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 871, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 871, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4);
    __pyx_t_4 = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":872
 * 
 *         for i, leaf in enumerate(self._leaves):
 *             if isinstance(leaf, Expression):             # <<<<<<<<<<<<<<
 *                 leaf_symbols = leaf._rebuild_cache().symbols
 *                 sym.update(leaf_symbols)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_leaf, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 872, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "mathics/core/expression.py":873
 *         for i, leaf in enumerate(self._leaves):
 *             if isinstance(leaf, Expression):
 *                 leaf_symbols = leaf._rebuild_cache().symbols             # <<<<<<<<<<<<<<
 *                 sym.update(leaf_symbols)
 *                 if "System`Sequence" in leaf_symbols:
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_rebuild_cache); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 873, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __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_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 873, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_symbols); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 873, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_leaf_symbols, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "mathics/core/expression.py":874
 *             if isinstance(leaf, Expression):
 *                 leaf_symbols = leaf._rebuild_cache().symbols
 *                 sym.update(leaf_symbols)             # <<<<<<<<<<<<<<
 *                 if "System`Sequence" in leaf_symbols:
 *                     seq.append(i)
 */
      __pyx_t_8 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_update, __pyx_v_sym, __pyx_v_leaf_symbols); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 874, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "mathics/core/expression.py":875
 *                 leaf_symbols = leaf._rebuild_cache().symbols
 *                 sym.update(leaf_symbols)
 *                 if "System`Sequence" in leaf_symbols:             # <<<<<<<<<<<<<<
 *                     seq.append(i)
 *             elif isinstance(leaf, Symbol):
 */
      __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_Sequence, __pyx_v_leaf_symbols, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 875, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_2 != 0);
      if (__pyx_t_3) {

        /* "mathics/core/expression.py":876
 *                 sym.update(leaf_symbols)
 *                 if "System`Sequence" in leaf_symbols:
 *                     seq.append(i)             # <<<<<<<<<<<<<<
 *             elif isinstance(leaf, Symbol):
 *                 sym.add(leaf.get_name())
 */
        __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_seq, __pyx_v_i); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 876, __pyx_L1_error)

        /* "mathics/core/expression.py":875
 *                 leaf_symbols = leaf._rebuild_cache().symbols
 *                 sym.update(leaf_symbols)
 *                 if "System`Sequence" in leaf_symbols:             # <<<<<<<<<<<<<<
 *                     seq.append(i)
 *             elif isinstance(leaf, Symbol):
 */
      }

      /* "mathics/core/expression.py":872
 * 
 *         for i, leaf in enumerate(self._leaves):
 *             if isinstance(leaf, Expression):             # <<<<<<<<<<<<<<
 *                 leaf_symbols = leaf._rebuild_cache().symbols
 *                 sym.update(leaf_symbols)
 */
      goto __pyx_L6;
    }

    /* "mathics/core/expression.py":877
 *                 if "System`Sequence" in leaf_symbols:
 *                     seq.append(i)
 *             elif isinstance(leaf, Symbol):             # <<<<<<<<<<<<<<
 *                 sym.add(leaf.get_name())
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_leaf, __pyx_t_8); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 877, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (__pyx_t_2) {

      /* "mathics/core/expression.py":878
 *                     seq.append(i)
 *             elif isinstance(leaf, Symbol):
 *                 sym.add(leaf.get_name())             # <<<<<<<<<<<<<<
 * 
 *         cache = ExpressionCache(time, sym, seq)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 878, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(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_8 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 878, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = PySet_Add(__pyx_v_sym, __pyx_t_8); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 878, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "mathics/core/expression.py":877
 *                 if "System`Sequence" in leaf_symbols:
 *                     seq.append(i)
 *             elif isinstance(leaf, Symbol):             # <<<<<<<<<<<<<<
 *                 sym.add(leaf.get_name())
 * 
 */
    }
    __pyx_L6:;

    /* "mathics/core/expression.py":871
 *         seq = []
 * 
 *         for i, leaf in enumerate(self._leaves):             # <<<<<<<<<<<<<<
 *             if isinstance(leaf, Expression):
 *                 leaf_symbols = leaf._rebuild_cache().symbols
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":880
 *                 sym.add(leaf.get_name())
 * 
 *         cache = ExpressionCache(time, sym, seq)             # <<<<<<<<<<<<<<
 *         self._cache = cache
 *         return cache
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ExpressionCache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_time, __pyx_v_sym, __pyx_v_seq};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 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_8, __pyx_v_time, __pyx_v_sym, __pyx_v_seq};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_time);
    __Pyx_GIVEREF(__pyx_v_time);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_11, __pyx_v_time);
    __Pyx_INCREF(__pyx_v_sym);
    __Pyx_GIVEREF(__pyx_v_sym);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_11, __pyx_v_sym);
    __Pyx_INCREF(__pyx_v_seq);
    __Pyx_GIVEREF(__pyx_v_seq);
    PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_11, __pyx_v_seq);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_cache, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "mathics/core/expression.py":881
 * 
 *         cache = ExpressionCache(time, sym, seq)
 *         self._cache = cache             # <<<<<<<<<<<<<<
 *         return cache
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cache, __pyx_v_cache) < 0) __PYX_ERR(0, 881, __pyx_L1_error)

  /* "mathics/core/expression.py":882
 *         cache = ExpressionCache(time, sym, seq)
 *         self._cache = cache
 *         return cache             # <<<<<<<<<<<<<<
 * 
 *     def has_changed(self, definitions):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_cache);
  __pyx_r = __pyx_v_cache;
  goto __pyx_L0;

  /* "mathics/core/expression.py":856
 *         return expr
 * 
 *     def _rebuild_cache(self):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 * 
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.core.expression.Expression._rebuild_cache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache);
  __Pyx_XDECREF(__pyx_v_time);
  __Pyx_XDECREF(__pyx_v_sym);
  __Pyx_XDECREF(__pyx_v_seq);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_v_leaf_symbols);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":884
 *         return cache
 * 
 *     def has_changed(self, definitions):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_31has_changed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_31has_changed = {"has_changed", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_31has_changed, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_31has_changed(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_definitions = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_changed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_definitions,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_definitions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("has_changed", 1, 2, 2, 1); __PYX_ERR(0, 884, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "has_changed") < 0)) __PYX_ERR(0, 884, __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_definitions = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_changed", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 884, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.has_changed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_30has_changed(__pyx_self, __pyx_v_self, __pyx_v_definitions);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_30has_changed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_definitions) {
  PyObject *__pyx_v_cache = NULL;
  PyObject *__pyx_v_time = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_changed", 0);

  /* "mathics/core/expression.py":885
 * 
 *     def has_changed(self, definitions):
 *         cache = self._cache             # <<<<<<<<<<<<<<
 * 
 *         if cache is None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cache = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":887
 *         cache = self._cache
 * 
 *         if cache is None:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_2 = (__pyx_v_cache == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":888
 * 
 *         if cache is None:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         time = cache.time
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":887
 *         cache = self._cache
 * 
 *         if cache is None:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  }

  /* "mathics/core/expression.py":890
 *             return True
 * 
 *         time = cache.time             # <<<<<<<<<<<<<<
 * 
 *         if time is None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_time = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":892
 *         time = cache.time
 * 
 *         if time is None:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_3 = (__pyx_v_time == Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":893
 * 
 *         if time is None:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         if cache.symbols is None:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":892
 *         time = cache.time
 * 
 *         if time is None:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  }

  /* "mathics/core/expression.py":895
 *             return True
 * 
 *         if cache.symbols is None:             # <<<<<<<<<<<<<<
 *             cache = self._rebuild_cache()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":896
 * 
 *         if cache.symbols is None:
 *             cache = self._rebuild_cache()             # <<<<<<<<<<<<<<
 * 
 *         return definitions.has_changed(time, cache.symbols)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rebuild_cache); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_cache, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":895
 *             return True
 * 
 *         if cache.symbols is None:             # <<<<<<<<<<<<<<
 *             cache = self._rebuild_cache()
 * 
 */
  }

  /* "mathics/core/expression.py":898
 *             cache = self._rebuild_cache()
 * 
 *         return definitions.has_changed(time, cache.symbols)             # <<<<<<<<<<<<<<
 * 
 *     def _timestamp_cache(self, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_definitions, __pyx_n_s_has_changed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_symbols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  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_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_time, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_time, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 898, __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_time);
    __Pyx_GIVEREF(__pyx_v_time);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_time);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":884
 *         return cache
 * 
 *     def has_changed(self, definitions):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.core.expression.Expression.has_changed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache);
  __Pyx_XDECREF(__pyx_v_time);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":900
 *         return definitions.has_changed(time, cache.symbols)
 * 
 *     def _timestamp_cache(self, evaluation):             # <<<<<<<<<<<<<<
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_33_timestamp_cache(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_33_timestamp_cache = {"_timestamp_cache", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_33_timestamp_cache, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_33_timestamp_cache(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_timestamp_cache (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_timestamp_cache", 1, 2, 2, 1); __PYX_ERR(0, 900, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_timestamp_cache") < 0)) __PYX_ERR(0, 900, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_timestamp_cache", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 900, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression._timestamp_cache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_32_timestamp_cache(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_32_timestamp_cache(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  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("_timestamp_cache", 0);

  /* "mathics/core/expression.py":901
 * 
 *     def _timestamp_cache(self, evaluation):
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self, reevaluate=False) -> "Expression":
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ExpressionCache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_now); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cache); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_copy, __pyx_t_4) < 0) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cache, __pyx_t_4) < 0) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":900
 *         return definitions.has_changed(time, cache.symbols)
 * 
 *     def _timestamp_cache(self, evaluation):             # <<<<<<<<<<<<<<
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)
 * 
 */

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

/* "mathics/core/expression.py":903
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)
 * 
 *     def copy(self, reevaluate=False) -> "Expression":             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_35copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_35copy = {"copy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_35copy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_35copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_reevaluate = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_reevaluate,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reevaluate);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy") < 0)) __PYX_ERR(0, 903, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_reevaluate = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 903, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_34copy(__pyx_self, __pyx_v_self, __pyx_v_reevaluate);

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

/* "mathics/core/expression.py":905
 *     def copy(self, reevaluate=False) -> "Expression":
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)             # <<<<<<<<<<<<<<
 *         if not reevaluate:
 *             # rebuilding the cache in self speeds up large operations, e.g.
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_4copy_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_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_7mathics_4core_10expression___pyx_scope_struct_10_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_10_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_10_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 905, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *) __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_7mathics_4core_10expression_10Expression_4copy_2generator4, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Expression_copy_locals_genexpr, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.copy.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_7mathics_4core_10expression_10Expression_4copy_2generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  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, 905, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 905, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 905, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 905, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 905, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 905, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_leaf);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_leaf, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_leaf, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_reevaluate)) { __Pyx_RaiseClosureNameError("reevaluate"); __PYX_ERR(0, 905, __pyx_L1_error) }
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_reevaluate) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_reevaluate);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 905, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

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

/* "mathics/core/expression.py":903
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)
 * 
 *     def copy(self, reevaluate=False) -> "Expression":             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_34copy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reevaluate) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *__pyx_cur_scope;
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_9_copy(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_9_copy, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 903, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_reevaluate = __pyx_v_reevaluate;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_reevaluate);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_reevaluate);

  /* "mathics/core/expression.py":904
 * 
 *     def copy(self, reevaluate=False) -> "Expression":
 *         expr = Expression(self._head.copy(reevaluate))             # <<<<<<<<<<<<<<
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)
 *         if not reevaluate:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_cur_scope->__pyx_v_reevaluate) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_reevaluate);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 904, __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_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_expr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":905
 *     def copy(self, reevaluate=False) -> "Expression":
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)             # <<<<<<<<<<<<<<
 *         if not reevaluate:
 *             # rebuilding the cache in self speeds up large operations, e.g.
 */
  __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_10Expression_4copy_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2, __pyx_t_2) < 0) __PYX_ERR(0, 905, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":906
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)
 *         if not reevaluate:             # <<<<<<<<<<<<<<
 *             # rebuilding the cache in self speeds up large operations, e.g.
 *             # First[Timing[Fold[#1+#2&, Range[750]]]]
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_reevaluate); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 906, __pyx_L1_error)
  __pyx_t_7 = ((!__pyx_t_6) != 0);
  if (__pyx_t_7) {

    /* "mathics/core/expression.py":909
 *             # rebuilding the cache in self speeds up large operations, e.g.
 *             # First[Timing[Fold[#1+#2&, Range[750]]]]
 *             expr._cache = self._rebuild_cache()             # <<<<<<<<<<<<<<
 *         expr.options = self.options
 *         expr.original = self
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_rebuild_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 909, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_cache, __pyx_t_2) < 0) __PYX_ERR(0, 909, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mathics/core/expression.py":906
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)
 *         if not reevaluate:             # <<<<<<<<<<<<<<
 *             # rebuilding the cache in self speeds up large operations, e.g.
 *             # First[Timing[Fold[#1+#2&, Range[750]]]]
 */
  }

  /* "mathics/core/expression.py":910
 *             # First[Timing[Fold[#1+#2&, Range[750]]]]
 *             expr._cache = self._rebuild_cache()
 *         expr.options = self.options             # <<<<<<<<<<<<<<
 *         expr.original = self
 *         expr._sequences = self._sequences
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_options, __pyx_t_2) < 0) __PYX_ERR(0, 910, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":911
 *             expr._cache = self._rebuild_cache()
 *         expr.options = self.options
 *         expr.original = self             # <<<<<<<<<<<<<<
 *         expr._sequences = self._sequences
 *         expr._format_cache = self._format_cache
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_original, __pyx_cur_scope->__pyx_v_self) < 0) __PYX_ERR(0, 911, __pyx_L1_error)

  /* "mathics/core/expression.py":912
 *         expr.options = self.options
 *         expr.original = self
 *         expr._sequences = self._sequences             # <<<<<<<<<<<<<<
 *         expr._format_cache = self._format_cache
 *         return expr
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_sequences_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_sequences_2, __pyx_t_2) < 0) __PYX_ERR(0, 912, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":913
 *         expr.original = self
 *         expr._sequences = self._sequences
 *         expr._format_cache = self._format_cache             # <<<<<<<<<<<<<<
 *         return expr
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_format_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_format_cache, __pyx_t_2) < 0) __PYX_ERR(0, 913, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":914
 *         expr._sequences = self._sequences
 *         expr._format_cache = self._format_cache
 *         return expr             # <<<<<<<<<<<<<<
 * 
 *     def do_format(self, evaluation, form):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "mathics/core/expression.py":903
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)
 * 
 *     def copy(self, reevaluate=False) -> "Expression":             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Expression.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":916
 *         return expr
 * 
 *     def do_format(self, evaluation, form):             # <<<<<<<<<<<<<<
 *         if self._format_cache is None:
 *             self._format_cache = {}
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_37do_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_37do_format = {"do_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_37do_format, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_37do_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, 1); __PYX_ERR(0, 916, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, 2); __PYX_ERR(0, 916, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "do_format") < 0)) __PYX_ERR(0, 916, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 916, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.do_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_36do_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_36do_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form) {
  PyObject *__pyx_v_last_evaluated = NULL;
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_v_symbolname = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("do_format", 0);

  /* "mathics/core/expression.py":917
 * 
 *     def do_format(self, evaluation, form):
 *         if self._format_cache is None:             # <<<<<<<<<<<<<<
 *             self._format_cache = {}
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_format_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":918
 *     def do_format(self, evaluation, form):
 *         if self._format_cache is None:
 *             self._format_cache = {}             # <<<<<<<<<<<<<<
 * 
 *         last_evaluated, expr = self._format_cache.get(form, (None, None))
 */
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_format_cache, __pyx_t_1) < 0) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":917
 * 
 *     def do_format(self, evaluation, form):
 *         if self._format_cache is None:             # <<<<<<<<<<<<<<
 *             self._format_cache = {}
 * 
 */
  }

  /* "mathics/core/expression.py":920
 *             self._format_cache = {}
 * 
 *         last_evaluated, expr = self._format_cache.get(form, (None, None))             # <<<<<<<<<<<<<<
 *         if last_evaluated is not None and expr is not None:
 *             symbolname = expr.get_name()
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_format_cache); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  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 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_form, __pyx_tuple__20};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_form, __pyx_tuple__20};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_form);
    __Pyx_GIVEREF(__pyx_v_form);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_form);
    __Pyx_INCREF(__pyx_tuple__20);
    __Pyx_GIVEREF(__pyx_tuple__20);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_tuple__20);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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, 920, __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_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #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, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 920, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 920, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __pyx_v_last_evaluated = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_expr = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "mathics/core/expression.py":921
 * 
 *         last_evaluated, expr = self._format_cache.get(form, (None, None))
 *         if last_evaluated is not None and expr is not None:             # <<<<<<<<<<<<<<
 *             symbolname = expr.get_name()
 *             if symbolname != "":
 */
  __pyx_t_2 = (__pyx_v_last_evaluated != Py_None);
  __pyx_t_9 = (__pyx_t_2 != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_3 = __pyx_t_9;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_9 = (__pyx_v_expr != Py_None);
  __pyx_t_2 = (__pyx_t_9 != 0);
  __pyx_t_3 = __pyx_t_2;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":922
 *         last_evaluated, expr = self._format_cache.get(form, (None, None))
 *         if last_evaluated is not None and expr is not None:
 *             symbolname = expr.get_name()             # <<<<<<<<<<<<<<
 *             if symbolname != "":
 *                 if not evaluation.definitions.has_changed(
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_get_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_symbolname = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":923
 *         if last_evaluated is not None and expr is not None:
 *             symbolname = expr.get_name()
 *             if symbolname != "":             # <<<<<<<<<<<<<<
 *                 if not evaluation.definitions.has_changed(
 *                     last_evaluated, (symbolname,)
 */
    __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_symbolname, __pyx_kp_u__3, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 923, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "mathics/core/expression.py":924
 *             symbolname = expr.get_name()
 *             if symbolname != "":
 *                 if not evaluation.definitions.has_changed(             # <<<<<<<<<<<<<<
 *                     last_evaluated, (symbolname,)
 *                 ):
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 924, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_has_changed); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 924, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "mathics/core/expression.py":925
 *             if symbolname != "":
 *                 if not evaluation.definitions.has_changed(
 *                     last_evaluated, (symbolname,)             # <<<<<<<<<<<<<<
 *                 ):
 *                     return expr
 */
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 925, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_symbolname);
      __Pyx_GIVEREF(__pyx_v_symbolname);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_symbolname);
      __pyx_t_4 = NULL;
      __pyx_t_6 = 0;
      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 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_last_evaluated, __pyx_t_7};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_last_evaluated, __pyx_t_7};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 924, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_last_evaluated);
        __Pyx_GIVEREF(__pyx_v_last_evaluated);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_6, __pyx_v_last_evaluated);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_6, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "mathics/core/expression.py":924
 *             symbolname = expr.get_name()
 *             if symbolname != "":
 *                 if not evaluation.definitions.has_changed(             # <<<<<<<<<<<<<<
 *                     last_evaluated, (symbolname,)
 *                 ):
 */
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 924, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_2 = ((!__pyx_t_3) != 0);
      if (__pyx_t_2) {

        /* "mathics/core/expression.py":927
 *                     last_evaluated, (symbolname,)
 *                 ):
 *                     return expr             # <<<<<<<<<<<<<<
 *         expr = super().do_format(evaluation, form)
 *         self._format_cache[form] = (evaluation.definitions.now, expr)
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_expr);
        __pyx_r = __pyx_v_expr;
        goto __pyx_L0;

        /* "mathics/core/expression.py":924
 *             symbolname = expr.get_name()
 *             if symbolname != "":
 *                 if not evaluation.definitions.has_changed(             # <<<<<<<<<<<<<<
 *                     last_evaluated, (symbolname,)
 *                 ):
 */
      }

      /* "mathics/core/expression.py":923
 *         if last_evaluated is not None and expr is not None:
 *             symbolname = expr.get_name()
 *             if symbolname != "":             # <<<<<<<<<<<<<<
 *                 if not evaluation.definitions.has_changed(
 *                     last_evaluated, (symbolname,)
 */
    }

    /* "mathics/core/expression.py":921
 * 
 *         last_evaluated, expr = self._format_cache.get(form, (None, None))
 *         if last_evaluated is not None and expr is not None:             # <<<<<<<<<<<<<<
 *             symbolname = expr.get_name()
 *             if symbolname != "":
 */
  }

  /* "mathics/core/expression.py":928
 *                 ):
 *                     return expr
 *         expr = super().do_format(evaluation, form)             # <<<<<<<<<<<<<<
 *         self._format_cache[form] = (evaluation.definitions.now, expr)
 *         return expr
 */
  __pyx_t_5 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_5) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 928, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_self);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_do_format); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_evaluation, __pyx_v_form};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_evaluation, __pyx_v_form};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_evaluation);
    __Pyx_INCREF(__pyx_v_form);
    __Pyx_GIVEREF(__pyx_v_form);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_form);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":929
 *                     return expr
 *         expr = super().do_format(evaluation, form)
 *         self._format_cache[form] = (evaluation.definitions.now, expr)             # <<<<<<<<<<<<<<
 *         return expr
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_now); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10);
  __Pyx_INCREF(__pyx_v_expr);
  __Pyx_GIVEREF(__pyx_v_expr);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_expr);
  __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_format_cache); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_v_form, __pyx_t_1) < 0)) __PYX_ERR(0, 929, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":930
 *         expr = super().do_format(evaluation, form)
 *         self._format_cache[form] = (evaluation.definitions.now, expr)
 *         return expr             # <<<<<<<<<<<<<<
 * 
 *     def shallow_copy(self) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "mathics/core/expression.py":916
 *         return expr
 * 
 *     def do_format(self, evaluation, form):             # <<<<<<<<<<<<<<
 *         if self._format_cache is None:
 *             self._format_cache = {}
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.Expression.do_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_last_evaluated);
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_symbolname);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":932
 *         return expr
 * 
 *     def shallow_copy(self) -> "Expression":             # <<<<<<<<<<<<<<
 *         # this is a minimal, shallow copy: head, leaves are shared with
 *         # the original, only the Expression instance is new.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_39shallow_copy(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_39shallow_copy = {"shallow_copy", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_39shallow_copy, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_39shallow_copy(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shallow_copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_38shallow_copy(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":935
 *         # this is a minimal, shallow copy: head, leaves are shared with
 *         # the original, only the Expression instance is new.
 *         expr = Expression(self._head)             # <<<<<<<<<<<<<<
 *         expr._leaves = self._leaves
 *         # rebuilding the cache in self speeds up large operations, e.g.
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_expr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":936
 *         # the original, only the Expression instance is new.
 *         expr = Expression(self._head)
 *         expr._leaves = self._leaves             # <<<<<<<<<<<<<<
 *         # rebuilding the cache in self speeds up large operations, e.g.
 *         # First[Timing[Fold[#1+#2&, Range[750]]]]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2, __pyx_t_1) < 0) __PYX_ERR(0, 936, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":939
 *         # rebuilding the cache in self speeds up large operations, e.g.
 *         # First[Timing[Fold[#1+#2&, Range[750]]]]
 *         expr._cache = self._rebuild_cache()             # <<<<<<<<<<<<<<
 *         expr.options = self.options
 *         # expr.last_evaluated = self.last_evaluated
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rebuild_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 939, __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, 939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_cache, __pyx_t_1) < 0) __PYX_ERR(0, 939, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":940
 *         # First[Timing[Fold[#1+#2&, Range[750]]]]
 *         expr._cache = self._rebuild_cache()
 *         expr.options = self.options             # <<<<<<<<<<<<<<
 *         # expr.last_evaluated = self.last_evaluated
 *         return expr
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_options, __pyx_t_1) < 0) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":942
 *         expr.options = self.options
 *         # expr.last_evaluated = self.last_evaluated
 *         return expr             # <<<<<<<<<<<<<<
 * 
 *     def set_positions(self, position=None) -> None:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "mathics/core/expression.py":932
 *         return expr
 * 
 *     def shallow_copy(self) -> "Expression":             # <<<<<<<<<<<<<<
 *         # this is a minimal, shallow copy: head, leaves are shared with
 *         # the original, only the Expression instance is new.
 */

  /* 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("mathics.core.expression.Expression.shallow_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":944
 *         return expr
 * 
 *     def set_positions(self, position=None) -> None:             # <<<<<<<<<<<<<<
 *         self.position = position
 *         self._head.set_positions(ExpressionPointer(self, 0))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_41set_positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_41set_positions = {"set_positions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_41set_positions, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_41set_positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_position = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_positions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_position,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_position);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_positions") < 0)) __PYX_ERR(0, 944, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_position = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_positions", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 944, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.set_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_40set_positions(__pyx_self, __pyx_v_self, __pyx_v_position);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_40set_positions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_position) {
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_positions", 0);

  /* "mathics/core/expression.py":945
 * 
 *     def set_positions(self, position=None) -> None:
 *         self.position = position             # <<<<<<<<<<<<<<
 *         self._head.set_positions(ExpressionPointer(self, 0))
 *         for index, leaf in enumerate(self._leaves):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_position, __pyx_v_position) < 0) __PYX_ERR(0, 945, __pyx_L1_error)

  /* "mathics/core/expression.py":946
 *     def set_positions(self, position=None) -> None:
 *         self.position = position
 *         self._head.set_positions(ExpressionPointer(self, 0))             # <<<<<<<<<<<<<<
 *         for index, leaf in enumerate(self._leaves):
 *             leaf.set_positions(ExpressionPointer(self, index + 1))
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_set_positions); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ExpressionPointer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_self, __pyx_int_0};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_self, __pyx_int_0};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_self);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_int_0);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":947
 *         self.position = position
 *         self._head.set_positions(ExpressionPointer(self, 0))
 *         for index, leaf in enumerate(self._leaves):             # <<<<<<<<<<<<<<
 *             leaf.set_positions(ExpressionPointer(self, index + 1))
 * 
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_1 = __pyx_int_0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 947, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 947, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 947, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_9(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 947, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_1);
    __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":948
 *         self._head.set_positions(ExpressionPointer(self, 0))
 *         for index, leaf in enumerate(self._leaves):
 *             leaf.set_positions(ExpressionPointer(self, index + 1))             # <<<<<<<<<<<<<<
 * 
 *     def get_head(self):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_set_positions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ExpressionPointer); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = __Pyx_PyInt_AddObjC(__pyx_v_index, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_v_self, __pyx_t_10};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_v_self, __pyx_t_10};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_v_self);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __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_3)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/core/expression.py":947
 *         self.position = position
 *         self._head.set_positions(ExpressionPointer(self, 0))
 *         for index, leaf in enumerate(self._leaves):             # <<<<<<<<<<<<<<
 *             leaf.set_positions(ExpressionPointer(self, index + 1))
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":944
 *         return expr
 * 
 *     def set_positions(self, position=None) -> None:             # <<<<<<<<<<<<<<
 *         self.position = position
 *         self._head.set_positions(ExpressionPointer(self, 0))
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("mathics.core.expression.Expression.set_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":950
 *             leaf.set_positions(ExpressionPointer(self, index + 1))
 * 
 *     def get_head(self):             # <<<<<<<<<<<<<<
 *         return self._head
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_43get_head(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_43get_head = {"get_head", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_43get_head, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_43get_head(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_head (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_42get_head(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":951
 * 
 *     def get_head(self):
 *         return self._head             # <<<<<<<<<<<<<<
 * 
 *     def set_head(self, head):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":950
 *             leaf.set_positions(ExpressionPointer(self, index + 1))
 * 
 *     def get_head(self):             # <<<<<<<<<<<<<<
 *         return self._head
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":953
 *         return self._head
 * 
 *     def set_head(self, head):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = None
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_45set_head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_45set_head = {"set_head", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_45set_head, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_45set_head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_head = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_head (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_head,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_head)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_head", 1, 2, 2, 1); __PYX_ERR(0, 953, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_head") < 0)) __PYX_ERR(0, 953, __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_head = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_head", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 953, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.set_head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_44set_head(__pyx_self, __pyx_v_self, __pyx_v_head);

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

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

  /* "mathics/core/expression.py":954
 * 
 *     def set_head(self, head):
 *         self._head = head             # <<<<<<<<<<<<<<
 *         self._cache = None
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_head_2, __pyx_v_head) < 0) __PYX_ERR(0, 954, __pyx_L1_error)

  /* "mathics/core/expression.py":955
 *     def set_head(self, head):
 *         self._head = head
 *         self._cache = None             # <<<<<<<<<<<<<<
 * 
 *     def get_leaves(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cache, Py_None) < 0) __PYX_ERR(0, 955, __pyx_L1_error)

  /* "mathics/core/expression.py":953
 *         return self._head
 * 
 *     def set_head(self, head):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = None
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.set_head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":957
 *         self._cache = None
 * 
 *     def get_leaves(self):             # <<<<<<<<<<<<<<
 *         return self._leaves
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_47get_leaves(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_47get_leaves = {"get_leaves", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_47get_leaves, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_47get_leaves(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_leaves (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_46get_leaves(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":958
 * 
 *     def get_leaves(self):
 *         return self._leaves             # <<<<<<<<<<<<<<
 * 
 *     def get_mutable_leaves(self):  # shallow, mutable copy of the leaves array
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":957
 *         self._cache = None
 * 
 *     def get_leaves(self):             # <<<<<<<<<<<<<<
 *         return self._leaves
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":960
 *         return self._leaves
 * 
 *     def get_mutable_leaves(self):  # shallow, mutable copy of the leaves array             # <<<<<<<<<<<<<<
 *         return list(self._leaves)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_49get_mutable_leaves(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_49get_mutable_leaves = {"get_mutable_leaves", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_49get_mutable_leaves, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_49get_mutable_leaves(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_mutable_leaves (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_48get_mutable_leaves(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":961
 * 
 *     def get_mutable_leaves(self):  # shallow, mutable copy of the leaves array
 *         return list(self._leaves)             # <<<<<<<<<<<<<<
 * 
 *     def set_leaf(self, index, value):  # leaves are removed, added or replaced
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 961, __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;

  /* "mathics/core/expression.py":960
 *         return self._leaves
 * 
 *     def get_mutable_leaves(self):  # shallow, mutable copy of the leaves array             # <<<<<<<<<<<<<<
 *         return list(self._leaves)
 * 
 */

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

/* "mathics/core/expression.py":963
 *         return list(self._leaves)
 * 
 *     def set_leaf(self, index, value):  # leaves are removed, added or replaced             # <<<<<<<<<<<<<<
 *         leaves = list(self._leaves)
 *         leaves[index] = value
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_51set_leaf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_51set_leaf = {"set_leaf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_51set_leaf, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_51set_leaf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_leaf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_index,&__pyx_n_s_value,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_leaf", 1, 3, 3, 1); __PYX_ERR(0, 963, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_leaf", 1, 3, 3, 2); __PYX_ERR(0, 963, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_leaf") < 0)) __PYX_ERR(0, 963, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_index = values[1];
    __pyx_v_value = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_leaf", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 963, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.set_leaf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_50set_leaf(__pyx_self, __pyx_v_self, __pyx_v_index, __pyx_v_value);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_50set_leaf(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_leaf", 0);

  /* "mathics/core/expression.py":964
 * 
 *     def set_leaf(self, index, value):  # leaves are removed, added or replaced
 *         leaves = list(self._leaves)             # <<<<<<<<<<<<<<
 *         leaves[index] = value
 *         self._leaves = tuple(leaves)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_leaves = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":965
 *     def set_leaf(self, index, value):  # leaves are removed, added or replaced
 *         leaves = list(self._leaves)
 *         leaves[index] = value             # <<<<<<<<<<<<<<
 *         self._leaves = tuple(leaves)
 *         self._cache = None
 */
  if (unlikely(PyObject_SetItem(__pyx_v_leaves, __pyx_v_index, __pyx_v_value) < 0)) __PYX_ERR(0, 965, __pyx_L1_error)

  /* "mathics/core/expression.py":966
 *         leaves = list(self._leaves)
 *         leaves[index] = value
 *         self._leaves = tuple(leaves)             # <<<<<<<<<<<<<<
 *         self._cache = None
 * 
 */
  __pyx_t_2 = PyList_AsTuple(__pyx_v_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2, __pyx_t_2) < 0) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":967
 *         leaves[index] = value
 *         self._leaves = tuple(leaves)
 *         self._cache = None             # <<<<<<<<<<<<<<
 * 
 *     def set_reordered_leaves(self, leaves):  # same leaves, but in a different order
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cache, Py_None) < 0) __PYX_ERR(0, 967, __pyx_L1_error)

  /* "mathics/core/expression.py":963
 *         return list(self._leaves)
 * 
 *     def set_leaf(self, index, value):  # leaves are removed, added or replaced             # <<<<<<<<<<<<<<
 *         leaves = list(self._leaves)
 *         leaves[index] = value
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.core.expression.Expression.set_leaf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":969
 *         self._cache = None
 * 
 *     def set_reordered_leaves(self, leaves):  # same leaves, but in a different order             # <<<<<<<<<<<<<<
 *         self._leaves = tuple(leaves)
 *         if self._cache:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_53set_reordered_leaves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_53set_reordered_leaves = {"set_reordered_leaves", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_53set_reordered_leaves, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_53set_reordered_leaves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_leaves = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_reordered_leaves (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_leaves,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_leaves)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_reordered_leaves", 1, 2, 2, 1); __PYX_ERR(0, 969, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_reordered_leaves") < 0)) __PYX_ERR(0, 969, __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_leaves = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_reordered_leaves", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 969, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.set_reordered_leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_52set_reordered_leaves(__pyx_self, __pyx_v_self, __pyx_v_leaves);

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

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

  /* "mathics/core/expression.py":970
 * 
 *     def set_reordered_leaves(self, leaves):  # same leaves, but in a different order
 *         self._leaves = tuple(leaves)             # <<<<<<<<<<<<<<
 *         if self._cache:
 *             self._cache = self._cache.reordered()
 */
  __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2, __pyx_t_1) < 0) __PYX_ERR(0, 970, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":971
 *     def set_reordered_leaves(self, leaves):  # same leaves, but in a different order
 *         self._leaves = tuple(leaves)
 *         if self._cache:             # <<<<<<<<<<<<<<
 *             self._cache = self._cache.reordered()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 971, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":972
 *         self._leaves = tuple(leaves)
 *         if self._cache:
 *             self._cache = self._cache.reordered()             # <<<<<<<<<<<<<<
 * 
 *     def get_attributes(self, definitions):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cache); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reordered); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cache, __pyx_t_1) < 0) __PYX_ERR(0, 972, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":971
 *     def set_reordered_leaves(self, leaves):  # same leaves, but in a different order
 *         self._leaves = tuple(leaves)
 *         if self._cache:             # <<<<<<<<<<<<<<
 *             self._cache = self._cache.reordered()
 * 
 */
  }

  /* "mathics/core/expression.py":969
 *         self._cache = None
 * 
 *     def set_reordered_leaves(self, leaves):  # same leaves, but in a different order             # <<<<<<<<<<<<<<
 *         self._leaves = tuple(leaves)
 *         if self._cache:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.Expression.set_reordered_leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":974
 *             self._cache = self._cache.reordered()
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:
 *             res = self._leaves[2]
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_55get_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_55get_attributes = {"get_attributes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_55get_attributes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_55get_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_definitions = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_attributes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_definitions,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_definitions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_attributes", 1, 2, 2, 1); __PYX_ERR(0, 974, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_attributes") < 0)) __PYX_ERR(0, 974, __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_definitions = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_attributes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 974, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_54get_attributes(__pyx_self, __pyx_v_self, __pyx_v_definitions);

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

/* "mathics/core/expression.py":980
 *                 return (str(res),)
 *             elif res.has_form("List", None):
 *                 return set(str(a) for a in res._leaves)             # <<<<<<<<<<<<<<
 *         return set()
 * 
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_14get_attributes_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_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_7mathics_4core_10expression___pyx_scope_struct_12_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_12_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_12_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 980, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *) __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_7mathics_4core_10expression_10Expression_14get_attributes_2generator5, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Expression_get_attributes_locals, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 980, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_attributes.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_7mathics_4core_10expression_10Expression_14get_attributes_2generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 980, __pyx_L1_error)
  __pyx_r = PySet_New(NULL); if (unlikely(!__pyx_r)) __PYX_ERR(0, 980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_res)) { __Pyx_RaiseClosureNameError("res"); __PYX_ERR(0, 980, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_res, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 980, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 980, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 980, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 980, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_a);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_a, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_cur_scope->__pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(PySet_Add(__pyx_r, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 980, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

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

/* "mathics/core/expression.py":974
 *             self._cache = self._cache.reordered()
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:
 *             res = self._leaves[2]
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_54get_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_definitions) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_attributes", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 974, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }

  /* "mathics/core/expression.py":975
 * 
 *     def get_attributes(self, definitions):
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:             # <<<<<<<<<<<<<<
 *             res = self._leaves[2]
 *             if res.is_symbol():
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_Function, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {
  } else {
    __pyx_t_1 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = ((__pyx_t_6 > 2) != 0);
  __pyx_t_1 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":976
 *     def get_attributes(self, definitions):
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:
 *             res = self._leaves[2]             # <<<<<<<<<<<<<<
 *             if res.is_symbol():
 *                 return (str(res),)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_cur_scope->__pyx_v_res = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":977
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:
 *             res = self._leaves[2]
 *             if res.is_symbol():             # <<<<<<<<<<<<<<
 *                 return (str(res),)
 *             elif res.has_form("List", None):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_res, __pyx_n_s_is_symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 977, __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_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 977, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":978
 *             res = self._leaves[2]
 *             if res.is_symbol():
 *                 return (str(res),)             # <<<<<<<<<<<<<<
 *             elif res.has_form("List", None):
 *                 return set(str(a) for a in res._leaves)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_cur_scope->__pyx_v_res); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 978, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 978, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":977
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:
 *             res = self._leaves[2]
 *             if res.is_symbol():             # <<<<<<<<<<<<<<
 *                 return (str(res),)
 *             elif res.has_form("List", None):
 */
    }

    /* "mathics/core/expression.py":979
 *             if res.is_symbol():
 *                 return (str(res),)
 *             elif res.has_form("List", None):             # <<<<<<<<<<<<<<
 *                 return set(str(a) for a in res._leaves)
 *         return set()
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_res, __pyx_n_s_has_form); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 979, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":980
 *                 return (str(res),)
 *             elif res.has_form("List", None):
 *                 return set(str(a) for a in res._leaves)             # <<<<<<<<<<<<<<
 *         return set()
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __pyx_pf_7mathics_4core_10expression_10Expression_14get_attributes_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 980, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":979
 *             if res.is_symbol():
 *                 return (str(res),)
 *             elif res.has_form("List", None):             # <<<<<<<<<<<<<<
 *                 return set(str(a) for a in res._leaves)
 *         return set()
 */
    }

    /* "mathics/core/expression.py":975
 * 
 *     def get_attributes(self, definitions):
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:             # <<<<<<<<<<<<<<
 *             res = self._leaves[2]
 *             if res.is_symbol():
 */
  }

  /* "mathics/core/expression.py":981
 *             elif res.has_form("List", None):
 *                 return set(str(a) for a in res._leaves)
 *         return set()             # <<<<<<<<<<<<<<
 * 
 *     def get_lookup_name(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":974
 *             self._cache = self._cache.reordered()
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:
 *             res = self._leaves[2]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":983
 *         return set()
 * 
 *     def get_lookup_name(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self._head.get_lookup_name()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_57get_lookup_name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_57get_lookup_name = {"get_lookup_name", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_57get_lookup_name, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_57get_lookup_name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_lookup_name (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_56get_lookup_name(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":984
 * 
 *     def get_lookup_name(self) -> bool:
 *         return self._head.get_lookup_name()             # <<<<<<<<<<<<<<
 * 
 *     def has_form(self, heads, *leaf_counts):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_lookup_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 984, __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;

  /* "mathics/core/expression.py":983
 *         return set()
 * 
 *     def get_lookup_name(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self._head.get_lookup_name()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_lookup_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":986
 *         return self._head.get_lookup_name()
 * 
 *     def has_form(self, heads, *leaf_counts):             # <<<<<<<<<<<<<<
 *         """
 *         leaf_counts:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_59has_form(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_10Expression_58has_form[] = "\n        leaf_counts:\n            (,):        no leaves allowed\n            (None,):    no constraint on number of leaves\n            (n, None):  leaf count >= n\n            (n1, n2, ...):    leaf count in {n1, n2, ...}\n        ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_59has_form = {"has_form", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_59has_form, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_10Expression_58has_form};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_59has_form(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_heads = 0;
  PyObject *__pyx_v_leaf_counts = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_form (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_leaf_counts = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_leaf_counts)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_leaf_counts);
  } else {
    __pyx_v_leaf_counts = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_heads,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_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_heads)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("has_form", 0, 2, 2, 1); __PYX_ERR(0, 986, __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, 0, values, used_pos_args, "has_form") < 0)) __PYX_ERR(0, 986, __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_heads = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_form", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 986, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_leaf_counts); __pyx_v_leaf_counts = 0;
  __Pyx_AddTraceback("mathics.core.expression.Expression.has_form", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_58has_form(__pyx_self, __pyx_v_self, __pyx_v_heads, __pyx_v_leaf_counts);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_58has_form(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_heads, PyObject *__pyx_v_leaf_counts) {
  PyObject *__pyx_v_head_name = NULL;
  Py_ssize_t __pyx_v_count;
  PyObject *__pyx_9genexpr12__pyx_v_h = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  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("has_form", 0);

  /* "mathics/core/expression.py":995
 *         """
 * 
 *         head_name = self._head.get_name()             # <<<<<<<<<<<<<<
 *         if isinstance(heads, (tuple, list, set)):
 *             if head_name not in [ensure_context(h) for h in heads]:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_head_name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":996
 * 
 *         head_name = self._head.get_name()
 *         if isinstance(heads, (tuple, list, set)):             # <<<<<<<<<<<<<<
 *             if head_name not in [ensure_context(h) for h in heads]:
 *                 return False
 */
  __pyx_t_5 = PyTuple_Check(__pyx_v_heads); 
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = PyList_Check(__pyx_v_heads); 
  __pyx_t_5 = (__pyx_t_6 != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = PySet_Check(__pyx_v_heads); 
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  __pyx_t_6 = (__pyx_t_4 != 0);
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":997
 *         head_name = self._head.get_name()
 *         if isinstance(heads, (tuple, list, set)):
 *             if head_name not in [ensure_context(h) for h in heads]:             # <<<<<<<<<<<<<<
 *                 return False
 *         else:
 */
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 997, __pyx_L10_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(PyList_CheckExact(__pyx_v_heads)) || PyTuple_CheckExact(__pyx_v_heads)) {
        __pyx_t_3 = __pyx_v_heads; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_heads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 997, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 997, __pyx_L10_error)
      }
      for (;;) {
        if (likely(!__pyx_t_8)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 997, __pyx_L10_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 997, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          } else {
            if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 997, __pyx_L10_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 997, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          }
        } else {
          __pyx_t_2 = __pyx_t_8(__pyx_t_3);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 997, __pyx_L10_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_h, __pyx_t_2);
        __pyx_t_2 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_ensure_context); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 997, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
          }
        }
        __pyx_t_2 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_9genexpr12__pyx_v_h) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_9genexpr12__pyx_v_h);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 997, __pyx_L10_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 997, __pyx_L10_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_h); __pyx_9genexpr12__pyx_v_h = 0;
      goto __pyx_L13_exit_scope;
      __pyx_L10_error:;
      __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_h); __pyx_9genexpr12__pyx_v_h = 0;
      goto __pyx_L1_error;
      __pyx_L13_exit_scope:;
    } /* exit inner scope */
    __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_head_name, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 997, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = (__pyx_t_6 != 0);
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":998
 *         if isinstance(heads, (tuple, list, set)):
 *             if head_name not in [ensure_context(h) for h in heads]:
 *                 return False             # <<<<<<<<<<<<<<
 *         else:
 *             if head_name != ensure_context(heads):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;

      /* "mathics/core/expression.py":997
 *         head_name = self._head.get_name()
 *         if isinstance(heads, (tuple, list, set)):
 *             if head_name not in [ensure_context(h) for h in heads]:             # <<<<<<<<<<<<<<
 *                 return False
 *         else:
 */
    }

    /* "mathics/core/expression.py":996
 * 
 *         head_name = self._head.get_name()
 *         if isinstance(heads, (tuple, list, set)):             # <<<<<<<<<<<<<<
 *             if head_name not in [ensure_context(h) for h in heads]:
 *                 return False
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":1000
 *                 return False
 *         else:
 *             if head_name != ensure_context(heads):             # <<<<<<<<<<<<<<
 *                 return False
 *         if not leaf_counts:
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ensure_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1000, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_heads) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_heads);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1000, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_head_name, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1000, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1000, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":1001
 *         else:
 *             if head_name != ensure_context(heads):
 *                 return False             # <<<<<<<<<<<<<<
 *         if not leaf_counts:
 *             return False
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1000
 *                 return False
 *         else:
 *             if head_name != ensure_context(heads):             # <<<<<<<<<<<<<<
 *                 return False
 *         if not leaf_counts:
 */
    }
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":1002
 *             if head_name != ensure_context(heads):
 *                 return False
 *         if not leaf_counts:             # <<<<<<<<<<<<<<
 *             return False
 *         if leaf_counts and leaf_counts[0] is not None:
 */
  __pyx_t_4 = (PyTuple_GET_SIZE(__pyx_v_leaf_counts) != 0);
  __pyx_t_6 = ((!__pyx_t_4) != 0);
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1003
 *                 return False
 *         if not leaf_counts:
 *             return False             # <<<<<<<<<<<<<<
 *         if leaf_counts and leaf_counts[0] is not None:
 *             count = len(self._leaves)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1002
 *             if head_name != ensure_context(heads):
 *                 return False
 *         if not leaf_counts:             # <<<<<<<<<<<<<<
 *             return False
 *         if leaf_counts and leaf_counts[0] is not None:
 */
  }

  /* "mathics/core/expression.py":1004
 *         if not leaf_counts:
 *             return False
 *         if leaf_counts and leaf_counts[0] is not None:             # <<<<<<<<<<<<<<
 *             count = len(self._leaves)
 *             if count not in leaf_counts:
 */
  __pyx_t_4 = (PyTuple_GET_SIZE(__pyx_v_leaf_counts) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_6 = __pyx_t_4;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_leaf_counts, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = (__pyx_t_3 != Py_None);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_6 = __pyx_t_5;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1005
 *             return False
 *         if leaf_counts and leaf_counts[0] is not None:
 *             count = len(self._leaves)             # <<<<<<<<<<<<<<
 *             if count not in leaf_counts:
 *                 if (
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1005, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_count = __pyx_t_7;

    /* "mathics/core/expression.py":1006
 *         if leaf_counts and leaf_counts[0] is not None:
 *             count = len(self._leaves)
 *             if count not in leaf_counts:             # <<<<<<<<<<<<<<
 *                 if (
 *                     len(leaf_counts) == 2
 */
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1006, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_t_3, __pyx_v_leaf_counts, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1006, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = (__pyx_t_6 != 0);
    if (__pyx_t_5) {

      /* "mathics/core/expression.py":1008
 *             if count not in leaf_counts:
 *                 if (
 *                     len(leaf_counts) == 2             # <<<<<<<<<<<<<<
 *                     and leaf_counts[1] is None  # noqa
 *                     and count >= leaf_counts[0]
 */
      __pyx_t_7 = PyTuple_GET_SIZE(__pyx_v_leaf_counts); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1008, __pyx_L1_error)
      __pyx_t_6 = ((__pyx_t_7 == 2) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_5 = __pyx_t_6;
        goto __pyx_L21_bool_binop_done;
      }

      /* "mathics/core/expression.py":1009
 *                 if (
 *                     len(leaf_counts) == 2
 *                     and leaf_counts[1] is None  # noqa             # <<<<<<<<<<<<<<
 *                     and count >= leaf_counts[0]
 *                 ):
 */
      __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_leaf_counts, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = (__pyx_t_3 == Py_None);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = (__pyx_t_6 != 0);
      if (__pyx_t_4) {
      } else {
        __pyx_t_5 = __pyx_t_4;
        goto __pyx_L21_bool_binop_done;
      }

      /* "mathics/core/expression.py":1010
 *                     len(leaf_counts) == 2
 *                     and leaf_counts[1] is None  # noqa
 *                     and count >= leaf_counts[0]             # <<<<<<<<<<<<<<
 *                 ):
 *                     return True
 */
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_leaf_counts, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1010, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1010, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __pyx_t_4;
      __pyx_L21_bool_binop_done:;

      /* "mathics/core/expression.py":1007
 *             count = len(self._leaves)
 *             if count not in leaf_counts:
 *                 if (             # <<<<<<<<<<<<<<
 *                     len(leaf_counts) == 2
 *                     and leaf_counts[1] is None  # noqa
 */
      if (__pyx_t_5) {

        /* "mathics/core/expression.py":1012
 *                     and count >= leaf_counts[0]
 *                 ):
 *                     return True             # <<<<<<<<<<<<<<
 *                 else:
 *                     return False
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_True);
        __pyx_r = Py_True;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1007
 *             count = len(self._leaves)
 *             if count not in leaf_counts:
 *                 if (             # <<<<<<<<<<<<<<
 *                     len(leaf_counts) == 2
 *                     and leaf_counts[1] is None  # noqa
 */
      }

      /* "mathics/core/expression.py":1014
 *                     return True
 *                 else:
 *                     return False             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_False);
        __pyx_r = Py_False;
        goto __pyx_L0;
      }

      /* "mathics/core/expression.py":1006
 *         if leaf_counts and leaf_counts[0] is not None:
 *             count = len(self._leaves)
 *             if count not in leaf_counts:             # <<<<<<<<<<<<<<
 *                 if (
 *                     len(leaf_counts) == 2
 */
    }

    /* "mathics/core/expression.py":1004
 *         if not leaf_counts:
 *             return False
 *         if leaf_counts and leaf_counts[0] is not None:             # <<<<<<<<<<<<<<
 *             count = len(self._leaves)
 *             if count not in leaf_counts:
 */
  }

  /* "mathics/core/expression.py":1015
 *                 else:
 *                     return False
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def has_symbol(self, symbol_name) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "mathics/core/expression.py":986
 *         return self._head.get_lookup_name()
 * 
 *     def has_form(self, heads, *leaf_counts):             # <<<<<<<<<<<<<<
 *         """
 *         leaf_counts:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.Expression.has_form", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_head_name);
  __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1017
 *         return True
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         if self._no_symbol(symbol_name):
 *             return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_61has_symbol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_61has_symbol = {"has_symbol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_61has_symbol, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_61has_symbol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_symbol_name = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_symbol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_symbol_name,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_symbol_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("has_symbol", 1, 2, 2, 1); __PYX_ERR(0, 1017, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "has_symbol") < 0)) __PYX_ERR(0, 1017, __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_symbol_name = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_symbol", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1017, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.has_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_60has_symbol(__pyx_self, __pyx_v_self, __pyx_v_symbol_name);

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

/* "mathics/core/expression.py":1021
 *             return False
 *         return self._head.has_symbol(symbol_name) or any(
 *             leaf.has_symbol(symbol_name) for leaf in self._leaves             # <<<<<<<<<<<<<<
 *         )
 * 
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_10has_symbol_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_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_7mathics_4core_10expression___pyx_scope_struct_14_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_14_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_14_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1021, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *) __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_7mathics_4core_10expression_10Expression_10has_symbol_2generator6, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Expression_has_symbol_locals_gen, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.has_symbol.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_7mathics_4core_10expression_10Expression_10has_symbol_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1021, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1021, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1021, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1021, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1021, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1021, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1021, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1021, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_leaf);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_leaf, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_leaf, __pyx_n_s_has_symbol); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_symbol_name)) { __Pyx_RaiseClosureNameError("symbol_name"); __PYX_ERR(0, 1021, __pyx_L1_error) }
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_symbol_name) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_symbol_name);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1021, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":1020
 *         if self._no_symbol(symbol_name):
 *             return False
 *         return self._head.has_symbol(symbol_name) or any(             # <<<<<<<<<<<<<<
 *             leaf.has_symbol(symbol_name) for leaf in self._leaves
 *         )
 */
      __Pyx_XDECREF(__pyx_r);

      /* "mathics/core/expression.py":1021
 *             return False
 *         return self._head.has_symbol(symbol_name) or any(
 *             leaf.has_symbol(symbol_name) for leaf in self._leaves             # <<<<<<<<<<<<<<
 *         )
 * 
 */
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {

    /* "mathics/core/expression.py":1020
 *         if self._no_symbol(symbol_name):
 *             return False
 *         return self._head.has_symbol(symbol_name) or any(             # <<<<<<<<<<<<<<
 *             leaf.has_symbol(symbol_name) for leaf in self._leaves
 *         )
 */
    __Pyx_XDECREF(__pyx_r);

    /* "mathics/core/expression.py":1021
 *             return False
 *         return self._head.has_symbol(symbol_name) or any(
 *             leaf.has_symbol(symbol_name) for leaf in self._leaves             # <<<<<<<<<<<<<<
 *         )
 * 
 */
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

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

/* "mathics/core/expression.py":1017
 *         return True
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         if self._no_symbol(symbol_name):
 *             return False
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_60has_symbol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_symbol_name) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *__pyx_cur_scope;
  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("has_symbol", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1017, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_symbol_name = __pyx_v_symbol_name;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_symbol_name);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_symbol_name);

  /* "mathics/core/expression.py":1018
 * 
 *     def has_symbol(self, symbol_name) -> bool:
 *         if self._no_symbol(symbol_name):             # <<<<<<<<<<<<<<
 *             return False
 *         return self._head.has_symbol(symbol_name) or any(
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_no_symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1018, __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_cur_scope->__pyx_v_symbol_name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_symbol_name);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1018, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1019
 *     def has_symbol(self, symbol_name) -> bool:
 *         if self._no_symbol(symbol_name):
 *             return False             # <<<<<<<<<<<<<<
 *         return self._head.has_symbol(symbol_name) or any(
 *             leaf.has_symbol(symbol_name) for leaf in self._leaves
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1018
 * 
 *     def has_symbol(self, symbol_name) -> bool:
 *         if self._no_symbol(symbol_name):             # <<<<<<<<<<<<<<
 *             return False
 *         return self._head.has_symbol(symbol_name) or any(
 */
  }

  /* "mathics/core/expression.py":1020
 *         if self._no_symbol(symbol_name):
 *             return False
 *         return self._head.has_symbol(symbol_name) or any(             # <<<<<<<<<<<<<<
 *             leaf.has_symbol(symbol_name) for leaf in self._leaves
 *         )
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_has_symbol); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_cur_scope->__pyx_v_symbol_name) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_symbol_name);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1020, __pyx_L1_error)
  if (!__pyx_t_4) {
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4_bool_binop_done;
  }

  /* "mathics/core/expression.py":1021
 *             return False
 *         return self._head.has_symbol(symbol_name) or any(
 *             leaf.has_symbol(symbol_name) for leaf in self._leaves             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_10has_symbol_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_L4_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1017
 *         return True
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         if self._no_symbol(symbol_name):
 *             return False
 */

  /* 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("mathics.core.expression.Expression.has_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1024
 *         )
 * 
 *     def _as_sympy_function(self, **kwargs) -> sympy.Function:             # <<<<<<<<<<<<<<
 *         sym_args = [leaf.to_sympy(**kwargs) for leaf in self.leaves]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_63_as_sympy_function(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_63_as_sympy_function = {"_as_sympy_function", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_63_as_sympy_function, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_63_as_sympy_function(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 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("_as_sympy_function (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "_as_sympy_function") < 0)) __PYX_ERR(0, 1024, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_as_sympy_function", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1024, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.Expression._as_sympy_function", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_62_as_sympy_function(__pyx_self, __pyx_v_self, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_62_as_sympy_function(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_sym_args = NULL;
  PyObject *__pyx_v_f = NULL;
  PyObject *__pyx_9genexpr14__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_as_sympy_function", 0);

  /* "mathics/core/expression.py":1025
 * 
 *     def _as_sympy_function(self, **kwargs) -> sympy.Function:
 *         sym_args = [leaf.to_sympy(**kwargs) for leaf in self.leaves]             # <<<<<<<<<<<<<<
 * 
 *         if None in sym_args:
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1025, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1025, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1025, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1025, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1025, __pyx_L5_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1025, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1025, __pyx_L5_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1025, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1025, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_leaf, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr14__pyx_v_leaf, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1025, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1025, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 1025, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_leaf); __pyx_9genexpr14__pyx_v_leaf = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_leaf); __pyx_9genexpr14__pyx_v_leaf = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_v_sym_args = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1027
 *         sym_args = [leaf.to_sympy(**kwargs) for leaf in self.leaves]
 * 
 *         if None in sym_args:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  __pyx_t_7 = (__Pyx_PySequence_ContainsTF(Py_None, __pyx_v_sym_args, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1027, __pyx_L1_error)
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "mathics/core/expression.py":1028
 * 
 *         if None in sym_args:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         f = sympy.Function(str(sympy_symbol_prefix + self.get_head_name()))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/core/expression.py":1027
 *         sym_args = [leaf.to_sympy(**kwargs) for leaf in self.leaves]
 * 
 *         if None in sym_args:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
  }

  /* "mathics/core/expression.py":1030
 *             return None
 * 
 *         f = sympy.Function(str(sympy_symbol_prefix + self.get_head_name()))             # <<<<<<<<<<<<<<
 *         return f(*sym_args)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sympy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Function); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sympy_symbol_prefix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_2 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_f = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1031
 * 
 *         f = sympy.Function(str(sympy_symbol_prefix + self.get_head_name()))
 *         return f(*sym_args)             # <<<<<<<<<<<<<<
 * 
 *     def to_sympy(self, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_Tuple(__pyx_v_sym_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_f, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1024
 *         )
 * 
 *     def _as_sympy_function(self, **kwargs) -> sympy.Function:             # <<<<<<<<<<<<<<
 *         sym_args = [leaf.to_sympy(**kwargs) for leaf in self.leaves]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.Expression._as_sympy_function", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sym_args);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1033
 *         return f(*sym_args)
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         from mathics.builtin import mathics_to_sympy
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_65to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_65to_sympy = {"to_sympy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_65to_sympy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_65to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 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("to_sympy (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "to_sympy") < 0)) __PYX_ERR(0, 1033, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_sympy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1033, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.Expression.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_64to_sympy(__pyx_self, __pyx_v_self, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_64to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_mathics_to_sympy = NULL;
  PyObject *__pyx_v_functions = NULL;
  PyObject *__pyx_v_sym_args = NULL;
  PyObject *__pyx_v_func = NULL;
  PyObject *__pyx_v_lookup_name = NULL;
  PyObject *__pyx_v_builtin = NULL;
  PyObject *__pyx_v_sympy_expr = NULL;
  PyObject *__pyx_9genexpr15__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_sympy", 0);

  /* "mathics/core/expression.py":1034
 * 
 *     def to_sympy(self, **kwargs):
 *         from mathics.builtin import mathics_to_sympy             # <<<<<<<<<<<<<<
 * 
 *         if "convert_all_global_functions" in kwargs:
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_mathics_to_sympy);
  __Pyx_GIVEREF(__pyx_n_s_mathics_to_sympy);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_mathics_to_sympy);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_builtin, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1034, __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_mathics_to_sympy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_mathics_to_sympy = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1036
 *         from mathics.builtin import mathics_to_sympy
 * 
 *         if "convert_all_global_functions" in kwargs:             # <<<<<<<<<<<<<<
 *             if len(self.leaves) > 0 and kwargs["convert_all_global_functions"]:
 *                 if self.get_head_name().startswith("Global`"):
 */
  __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_u_convert_all_global_functions, __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1036, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1037
 * 
 *         if "convert_all_global_functions" in kwargs:
 *             if len(self.leaves) > 0 and kwargs["convert_all_global_functions"]:             # <<<<<<<<<<<<<<
 *                 if self.get_head_name().startswith("Global`"):
 *                     return self._as_sympy_function(**kwargs)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1037, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = ((__pyx_t_5 > 0) != 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_4 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_n_u_convert_all_global_functions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1037, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":1038
 *         if "convert_all_global_functions" in kwargs:
 *             if len(self.leaves) > 0 and kwargs["convert_all_global_functions"]:
 *                 if self.get_head_name().startswith("Global`"):             # <<<<<<<<<<<<<<
 *                     return self._as_sympy_function(**kwargs)
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1038, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_startswith); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_kp_u_Global) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_Global);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1038, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1038, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_4) {

        /* "mathics/core/expression.py":1039
 *             if len(self.leaves) > 0 and kwargs["convert_all_global_functions"]:
 *                 if self.get_head_name().startswith("Global`"):
 *                     return self._as_sympy_function(**kwargs)             # <<<<<<<<<<<<<<
 * 
 *         if "converted_functions" in kwargs:
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_as_sympy_function); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1039, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1039, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1038
 *         if "convert_all_global_functions" in kwargs:
 *             if len(self.leaves) > 0 and kwargs["convert_all_global_functions"]:
 *                 if self.get_head_name().startswith("Global`"):             # <<<<<<<<<<<<<<
 *                     return self._as_sympy_function(**kwargs)
 * 
 */
      }

      /* "mathics/core/expression.py":1037
 * 
 *         if "convert_all_global_functions" in kwargs:
 *             if len(self.leaves) > 0 and kwargs["convert_all_global_functions"]:             # <<<<<<<<<<<<<<
 *                 if self.get_head_name().startswith("Global`"):
 *                     return self._as_sympy_function(**kwargs)
 */
    }

    /* "mathics/core/expression.py":1036
 *         from mathics.builtin import mathics_to_sympy
 * 
 *         if "convert_all_global_functions" in kwargs:             # <<<<<<<<<<<<<<
 *             if len(self.leaves) > 0 and kwargs["convert_all_global_functions"]:
 *                 if self.get_head_name().startswith("Global`"):
 */
  }

  /* "mathics/core/expression.py":1041
 *                     return self._as_sympy_function(**kwargs)
 * 
 *         if "converted_functions" in kwargs:             # <<<<<<<<<<<<<<
 *             functions = kwargs["converted_functions"]
 *             if len(self._leaves) > 0 and self.get_head_name() in functions:
 */
  __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_u_converted_functions, __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":1042
 * 
 *         if "converted_functions" in kwargs:
 *             functions = kwargs["converted_functions"]             # <<<<<<<<<<<<<<
 *             if len(self._leaves) > 0 and self.get_head_name() in functions:
 *                 sym_args = [leaf.to_sympy() for leaf in self._leaves]
 */
    __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_v_kwargs, __pyx_n_u_converted_functions); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_functions = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "mathics/core/expression.py":1043
 *         if "converted_functions" in kwargs:
 *             functions = kwargs["converted_functions"]
 *             if len(self._leaves) > 0 and self.get_head_name() in functions:             # <<<<<<<<<<<<<<
 *                 sym_args = [leaf.to_sympy() for leaf in self._leaves]
 *                 if None in sym_args:
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_4 = ((__pyx_t_5 > 0) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_3 = __pyx_t_4;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_functions, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = (__pyx_t_4 != 0);
    __pyx_t_3 = __pyx_t_8;
    __pyx_L10_bool_binop_done:;
    if (__pyx_t_3) {

      /* "mathics/core/expression.py":1044
 *             functions = kwargs["converted_functions"]
 *             if len(self._leaves) > 0 and self.get_head_name() in functions:
 *                 sym_args = [leaf.to_sympy() for leaf in self._leaves]             # <<<<<<<<<<<<<<
 *                 if None in sym_args:
 *                     return None
 */
      { /* enter inner scope */
        __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1044, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1044, __pyx_L14_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
          __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
          __pyx_t_9 = NULL;
        } else {
          __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1044, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1044, __pyx_L14_error)
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        for (;;) {
          if (likely(!__pyx_t_9)) {
            if (likely(PyList_CheckExact(__pyx_t_1))) {
              if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1044, __pyx_L14_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1044, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            } else {
              if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1044, __pyx_L14_error)
              #else
              __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1044, __pyx_L14_error)
              __Pyx_GOTREF(__pyx_t_2);
              #endif
            }
          } else {
            __pyx_t_2 = __pyx_t_9(__pyx_t_1);
            if (unlikely(!__pyx_t_2)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 1044, __pyx_L14_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_2);
          }
          __Pyx_XDECREF_SET(__pyx_9genexpr15__pyx_v_leaf, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr15__pyx_v_leaf, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1044, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_10 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_10)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_10);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
            }
          }
          __pyx_t_2 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1044, __pyx_L14_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 1044, __pyx_L14_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_leaf); __pyx_9genexpr15__pyx_v_leaf = 0;
        goto __pyx_L17_exit_scope;
        __pyx_L14_error:;
        __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_leaf); __pyx_9genexpr15__pyx_v_leaf = 0;
        goto __pyx_L1_error;
        __pyx_L17_exit_scope:;
      } /* exit inner scope */
      __pyx_v_sym_args = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "mathics/core/expression.py":1045
 *             if len(self._leaves) > 0 and self.get_head_name() in functions:
 *                 sym_args = [leaf.to_sympy() for leaf in self._leaves]
 *                 if None in sym_args:             # <<<<<<<<<<<<<<
 *                     return None
 *                 func = sympy.Function(str(sympy_symbol_prefix + self.get_head_name()))(
 */
      __pyx_t_3 = (__Pyx_PySequence_ContainsTF(Py_None, __pyx_v_sym_args, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1045, __pyx_L1_error)
      __pyx_t_8 = (__pyx_t_3 != 0);
      if (__pyx_t_8) {

        /* "mathics/core/expression.py":1046
 *                 sym_args = [leaf.to_sympy() for leaf in self._leaves]
 *                 if None in sym_args:
 *                     return None             # <<<<<<<<<<<<<<
 *                 func = sympy.Function(str(sympy_symbol_prefix + self.get_head_name()))(
 *                     *sym_args
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L0;

        /* "mathics/core/expression.py":1045
 *             if len(self._leaves) > 0 and self.get_head_name() in functions:
 *                 sym_args = [leaf.to_sympy() for leaf in self._leaves]
 *                 if None in sym_args:             # <<<<<<<<<<<<<<
 *                     return None
 *                 func = sympy.Function(str(sympy_symbol_prefix + self.get_head_name()))(
 */
      }

      /* "mathics/core/expression.py":1047
 *                 if None in sym_args:
 *                     return None
 *                 func = sympy.Function(str(sympy_symbol_prefix + self.get_head_name()))(             # <<<<<<<<<<<<<<
 *                     *sym_args
 *                 )
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sympy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Function); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sympy_symbol_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_7 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_6 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_10, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1048
 *                     return None
 *                 func = sympy.Function(str(sympy_symbol_prefix + self.get_head_name()))(
 *                     *sym_args             # <<<<<<<<<<<<<<
 *                 )
 *                 return func
 */
      __pyx_t_2 = PySequence_Tuple(__pyx_v_sym_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "mathics/core/expression.py":1047
 *                 if None in sym_args:
 *                     return None
 *                 func = sympy.Function(str(sympy_symbol_prefix + self.get_head_name()))(             # <<<<<<<<<<<<<<
 *                     *sym_args
 *                 )
 */
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_func = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "mathics/core/expression.py":1050
 *                     *sym_args
 *                 )
 *                 return func             # <<<<<<<<<<<<<<
 * 
 *         lookup_name = self.get_lookup_name()
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_func);
      __pyx_r = __pyx_v_func;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1043
 *         if "converted_functions" in kwargs:
 *             functions = kwargs["converted_functions"]
 *             if len(self._leaves) > 0 and self.get_head_name() in functions:             # <<<<<<<<<<<<<<
 *                 sym_args = [leaf.to_sympy() for leaf in self._leaves]
 *                 if None in sym_args:
 */
    }

    /* "mathics/core/expression.py":1041
 *                     return self._as_sympy_function(**kwargs)
 * 
 *         if "converted_functions" in kwargs:             # <<<<<<<<<<<<<<
 *             functions = kwargs["converted_functions"]
 *             if len(self._leaves) > 0 and self.get_head_name() in functions:
 */
  }

  /* "mathics/core/expression.py":1052
 *                 return func
 * 
 *         lookup_name = self.get_lookup_name()             # <<<<<<<<<<<<<<
 *         builtin = mathics_to_sympy.get(lookup_name)
 *         if builtin is not None:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_lookup_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_lookup_name = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "mathics/core/expression.py":1053
 * 
 *         lookup_name = self.get_lookup_name()
 *         builtin = mathics_to_sympy.get(lookup_name)             # <<<<<<<<<<<<<<
 *         if builtin is not None:
 *             sympy_expr = builtin.to_sympy(self, **kwargs)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_mathics_to_sympy, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_v_lookup_name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_lookup_name);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_builtin = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "mathics/core/expression.py":1054
 *         lookup_name = self.get_lookup_name()
 *         builtin = mathics_to_sympy.get(lookup_name)
 *         if builtin is not None:             # <<<<<<<<<<<<<<
 *             sympy_expr = builtin.to_sympy(self, **kwargs)
 *             if sympy_expr is not None:
 */
  __pyx_t_8 = (__pyx_v_builtin != Py_None);
  __pyx_t_3 = (__pyx_t_8 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":1055
 *         builtin = mathics_to_sympy.get(lookup_name)
 *         if builtin is not None:
 *             sympy_expr = builtin.to_sympy(self, **kwargs)             # <<<<<<<<<<<<<<
 *             if sympy_expr is not None:
 *                 return sympy_expr
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_builtin, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_v_kwargs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_sympy_expr = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "mathics/core/expression.py":1056
 *         if builtin is not None:
 *             sympy_expr = builtin.to_sympy(self, **kwargs)
 *             if sympy_expr is not None:             # <<<<<<<<<<<<<<
 *                 return sympy_expr
 * 
 */
    __pyx_t_3 = (__pyx_v_sympy_expr != Py_None);
    __pyx_t_8 = (__pyx_t_3 != 0);
    if (__pyx_t_8) {

      /* "mathics/core/expression.py":1057
 *             sympy_expr = builtin.to_sympy(self, **kwargs)
 *             if sympy_expr is not None:
 *                 return sympy_expr             # <<<<<<<<<<<<<<
 * 
 *         return SympyExpression(self)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_sympy_expr);
      __pyx_r = __pyx_v_sympy_expr;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1056
 *         if builtin is not None:
 *             sympy_expr = builtin.to_sympy(self, **kwargs)
 *             if sympy_expr is not None:             # <<<<<<<<<<<<<<
 *                 return sympy_expr
 * 
 */
    }

    /* "mathics/core/expression.py":1054
 *         lookup_name = self.get_lookup_name()
 *         builtin = mathics_to_sympy.get(lookup_name)
 *         if builtin is not None:             # <<<<<<<<<<<<<<
 *             sympy_expr = builtin.to_sympy(self, **kwargs)
 *             if sympy_expr is not None:
 */
  }

  /* "mathics/core/expression.py":1059
 *                 return sympy_expr
 * 
 *         return SympyExpression(self)             # <<<<<<<<<<<<<<
 * 
 *     def to_python(self, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SympyExpression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1033
 *         return f(*sym_args)
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         from mathics.builtin import mathics_to_sympy
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("mathics.core.expression.Expression.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mathics_to_sympy);
  __Pyx_XDECREF(__pyx_v_functions);
  __Pyx_XDECREF(__pyx_v_sym_args);
  __Pyx_XDECREF(__pyx_v_func);
  __Pyx_XDECREF(__pyx_v_lookup_name);
  __Pyx_XDECREF(__pyx_v_builtin);
  __Pyx_XDECREF(__pyx_v_sympy_expr);
  __Pyx_XDECREF(__pyx_9genexpr15__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1061
 *         return SympyExpression(self)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Convert the Expression to a Python object:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_67to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_10Expression_66to_python[] = "\n        Convert the Expression to a Python object:\n        List[...]  -> Python list\n        DirectedInfinity[1] -> inf\n        DirectedInfinity[-1] -> -inf\n        True/False -> True/False\n        Null       -> None\n        Symbol     -> '...'\n        String     -> '\"...\"'\n        Function   -> python function\n        numbers    -> Python number\n        If kwarg n_evaluation is given, apply N first to the expression.\n        ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_67to_python = {"to_python", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_67to_python, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_10Expression_66to_python};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_67to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 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("to_python (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_self,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_self)) != 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, "to_python") < 0)) __PYX_ERR(0, 1061, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_python", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1061, __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("mathics.core.expression.Expression.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_66to_python(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_66to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_mathics_to_python = NULL;
  PyObject *__pyx_v_n_evaluation = NULL;
  PyObject *__pyx_v_head_name = NULL;
  PyObject *__pyx_v_compiled = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_direction = NULL;
  PyObject *__pyx_v_py_obj = NULL;
  PyObject *__pyx_9genexpr16__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_python", 0);

  /* "mathics/core/expression.py":1075
 *         If kwarg n_evaluation is given, apply N first to the expression.
 *         """
 *         from mathics.builtin.base import mathics_to_python             # <<<<<<<<<<<<<<
 * 
 *         n_evaluation = kwargs.get("n_evaluation")
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_mathics_to_python);
  __Pyx_GIVEREF(__pyx_n_s_mathics_to_python);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_mathics_to_python);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_builtin_base, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1075, __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_mathics_to_python); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_mathics_to_python = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1077
 *         from mathics.builtin.base import mathics_to_python
 * 
 *         n_evaluation = kwargs.get("n_evaluation")             # <<<<<<<<<<<<<<
 *         head_name = self._head.get_name()
 *         if n_evaluation is not None:
 */
  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_u_n_evaluation, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_n_evaluation = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1078
 * 
 *         n_evaluation = kwargs.get("n_evaluation")
 *         head_name = self._head.get_name()             # <<<<<<<<<<<<<<
 *         if n_evaluation is not None:
 *             if head_name == "System`Function":
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_head_name = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1079
 *         n_evaluation = kwargs.get("n_evaluation")
 *         head_name = self._head.get_name()
 *         if n_evaluation is not None:             # <<<<<<<<<<<<<<
 *             if head_name == "System`Function":
 *                 compiled = Expression("System`Compile", *(self._leaves))
 */
  __pyx_t_4 = (__pyx_v_n_evaluation != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":1080
 *         head_name = self._head.get_name()
 *         if n_evaluation is not None:
 *             if head_name == "System`Function":             # <<<<<<<<<<<<<<
 *                 compiled = Expression("System`Compile", *(self._leaves))
 *                 compiled = compiled.evaluate(n_evaluation)
 */
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_head_name, __pyx_kp_u_System_Function, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1080, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "mathics/core/expression.py":1081
 *         if n_evaluation is not None:
 *             if head_name == "System`Function":
 *                 compiled = Expression("System`Compile", *(self._leaves))             # <<<<<<<<<<<<<<
 *                 compiled = compiled.evaluate(n_evaluation)
 *                 if compiled.get_head_name() == "System`CompiledFunction":
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(__pyx_tuple__21, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_compiled = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "mathics/core/expression.py":1082
 *             if head_name == "System`Function":
 *                 compiled = Expression("System`Compile", *(self._leaves))
 *                 compiled = compiled.evaluate(n_evaluation)             # <<<<<<<<<<<<<<
 *                 if compiled.get_head_name() == "System`CompiledFunction":
 *                     return compiled.leaves[2].cfunc
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_compiled, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1082, __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_n_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_n_evaluation);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1082, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_compiled, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/core/expression.py":1083
 *                 compiled = Expression("System`Compile", *(self._leaves))
 *                 compiled = compiled.evaluate(n_evaluation)
 *                 if compiled.get_head_name() == "System`CompiledFunction":             # <<<<<<<<<<<<<<
 *                     return compiled.leaves[2].cfunc
 *             value = Expression(SymbolN, self).evaluate(n_evaluation)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_compiled, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1083, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1083, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_CompiledFunction, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1083, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_5) {

        /* "mathics/core/expression.py":1084
 *                 compiled = compiled.evaluate(n_evaluation)
 *                 if compiled.get_head_name() == "System`CompiledFunction":
 *                     return compiled.leaves[2].cfunc             # <<<<<<<<<<<<<<
 *             value = Expression(SymbolN, self).evaluate(n_evaluation)
 *             return value.to_python()
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_compiled, __pyx_n_s_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1084, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1084, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cfunc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1084, __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;

        /* "mathics/core/expression.py":1083
 *                 compiled = Expression("System`Compile", *(self._leaves))
 *                 compiled = compiled.evaluate(n_evaluation)
 *                 if compiled.get_head_name() == "System`CompiledFunction":             # <<<<<<<<<<<<<<
 *                     return compiled.leaves[2].cfunc
 *             value = Expression(SymbolN, self).evaluate(n_evaluation)
 */
      }

      /* "mathics/core/expression.py":1080
 *         head_name = self._head.get_name()
 *         if n_evaluation is not None:
 *             if head_name == "System`Function":             # <<<<<<<<<<<<<<
 *                 compiled = Expression("System`Compile", *(self._leaves))
 *                 compiled = compiled.evaluate(n_evaluation)
 */
    }

    /* "mathics/core/expression.py":1085
 *                 if compiled.get_head_name() == "System`CompiledFunction":
 *                     return compiled.leaves[2].cfunc
 *             value = Expression(SymbolN, self).evaluate(n_evaluation)             # <<<<<<<<<<<<<<
 *             return value.to_python()
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_self};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_self};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1085, __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_6);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_self);
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1085, __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_n_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_n_evaluation);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_value = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1086
 *                     return compiled.leaves[2].cfunc
 *             value = Expression(SymbolN, self).evaluate(n_evaluation)
 *             return value.to_python()             # <<<<<<<<<<<<<<
 * 
 *         if head_name == "System`DirectedInfinity" and len(self._leaves) == 1:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_to_python); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1079
 *         n_evaluation = kwargs.get("n_evaluation")
 *         head_name = self._head.get_name()
 *         if n_evaluation is not None:             # <<<<<<<<<<<<<<
 *             if head_name == "System`Function":
 *                 compiled = Expression("System`Compile", *(self._leaves))
 */
  }

  /* "mathics/core/expression.py":1088
 *             return value.to_python()
 * 
 *         if head_name == "System`DirectedInfinity" and len(self._leaves) == 1:             # <<<<<<<<<<<<<<
 *             direction = self._leaves[0].get_int_value()
 *             if direction == 1:
 */
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_head_name, __pyx_kp_u_System_DirectedInfinity, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1088, __pyx_L1_error)
  if (__pyx_t_4) {
  } else {
    __pyx_t_5 = __pyx_t_4;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = ((__pyx_t_10 == 1) != 0);
  __pyx_t_5 = __pyx_t_4;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":1089
 * 
 *         if head_name == "System`DirectedInfinity" and len(self._leaves) == 1:
 *             direction = self._leaves[0].get_int_value()             # <<<<<<<<<<<<<<
 *             if direction == 1:
 *                 return math.inf
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1089, __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, 1089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_direction = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1090
 *         if head_name == "System`DirectedInfinity" and len(self._leaves) == 1:
 *             direction = self._leaves[0].get_int_value()
 *             if direction == 1:             # <<<<<<<<<<<<<<
 *                 return math.inf
 *             if direction == -1:
 */
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_direction, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_5) {

      /* "mathics/core/expression.py":1091
 *             direction = self._leaves[0].get_int_value()
 *             if direction == 1:
 *                 return math.inf             # <<<<<<<<<<<<<<
 *             if direction == -1:
 *                 return -math.inf
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1091, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_inf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1091, __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;

      /* "mathics/core/expression.py":1090
 *         if head_name == "System`DirectedInfinity" and len(self._leaves) == 1:
 *             direction = self._leaves[0].get_int_value()
 *             if direction == 1:             # <<<<<<<<<<<<<<
 *                 return math.inf
 *             if direction == -1:
 */
    }

    /* "mathics/core/expression.py":1092
 *             if direction == 1:
 *                 return math.inf
 *             if direction == -1:             # <<<<<<<<<<<<<<
 *                 return -math.inf
 *         elif head_name == "System`List":
 */
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_direction, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1092, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_5) {

      /* "mathics/core/expression.py":1093
 *                 return math.inf
 *             if direction == -1:
 *                 return -math.inf             # <<<<<<<<<<<<<<
 *         elif head_name == "System`List":
 *             return [leaf.to_python(*args, **kwargs) for leaf in self._leaves]
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1093, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_inf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1093, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1093, __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;

      /* "mathics/core/expression.py":1092
 *             if direction == 1:
 *                 return math.inf
 *             if direction == -1:             # <<<<<<<<<<<<<<
 *                 return -math.inf
 *         elif head_name == "System`List":
 */
    }

    /* "mathics/core/expression.py":1088
 *             return value.to_python()
 * 
 *         if head_name == "System`DirectedInfinity" and len(self._leaves) == 1:             # <<<<<<<<<<<<<<
 *             direction = self._leaves[0].get_int_value()
 *             if direction == 1:
 */
    goto __pyx_L6;
  }

  /* "mathics/core/expression.py":1094
 *             if direction == -1:
 *                 return -math.inf
 *         elif head_name == "System`List":             # <<<<<<<<<<<<<<
 *             return [leaf.to_python(*args, **kwargs) for leaf in self._leaves]
 * 
 */
  __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_v_head_name, __pyx_kp_u_System_List, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1094, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":1095
 *                 return -math.inf
 *         elif head_name == "System`List":
 *             return [leaf.to_python(*args, **kwargs) for leaf in self._leaves]             # <<<<<<<<<<<<<<
 * 
 *         if head_name in mathics_to_python:
 */
    __Pyx_XDECREF(__pyx_r);
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1095, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1095, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
        __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
      } else {
        __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1095, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1095, __pyx_L13_error)
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        if (likely(!__pyx_t_11)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1095, __pyx_L13_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1095, __pyx_L13_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          } else {
            if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1095, __pyx_L13_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1095, __pyx_L13_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          }
        } else {
          __pyx_t_1 = __pyx_t_11(__pyx_t_3);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1095, __pyx_L13_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr16__pyx_v_leaf, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr16__pyx_v_leaf, __pyx_n_s_to_python); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1095, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1095, __pyx_L13_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1095, __pyx_L13_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_leaf); __pyx_9genexpr16__pyx_v_leaf = 0;
      goto __pyx_L16_exit_scope;
      __pyx_L13_error:;
      __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_leaf); __pyx_9genexpr16__pyx_v_leaf = 0;
      goto __pyx_L1_error;
      __pyx_L16_exit_scope:;
    } /* exit inner scope */
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1094
 *             if direction == -1:
 *                 return -math.inf
 *         elif head_name == "System`List":             # <<<<<<<<<<<<<<
 *             return [leaf.to_python(*args, **kwargs) for leaf in self._leaves]
 * 
 */
  }
  __pyx_L6:;

  /* "mathics/core/expression.py":1097
 *             return [leaf.to_python(*args, **kwargs) for leaf in self._leaves]
 * 
 *         if head_name in mathics_to_python:             # <<<<<<<<<<<<<<
 *             py_obj = mathics_to_python[head_name]
 *             # Start here
 */
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_head_name, __pyx_v_mathics_to_python, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1097, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1098
 * 
 *         if head_name in mathics_to_python:
 *             py_obj = mathics_to_python[head_name]             # <<<<<<<<<<<<<<
 *             # Start here
 *             # if inspect.isfunction(py_obj) or inspect.isbuiltin(py_obj):
 */
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_mathics_to_python, __pyx_v_head_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1098, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_py_obj = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1107
 *             #         keywords=[],
 *             #         )
 *             return py_obj             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_py_obj);
    __pyx_r = __pyx_v_py_obj;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1097
 *             return [leaf.to_python(*args, **kwargs) for leaf in self._leaves]
 * 
 *         if head_name in mathics_to_python:             # <<<<<<<<<<<<<<
 *             py_obj = mathics_to_python[head_name]
 *             # Start here
 */
  }

  /* "mathics/core/expression.py":1108
 *             #         )
 *             return py_obj
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def get_sort_key(self, pattern_sort=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1061
 *         return SympyExpression(self)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Convert the Expression to a Python object:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.core.expression.Expression.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mathics_to_python);
  __Pyx_XDECREF(__pyx_v_n_evaluation);
  __Pyx_XDECREF(__pyx_v_head_name);
  __Pyx_XDECREF(__pyx_v_compiled);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_direction);
  __Pyx_XDECREF(__pyx_v_py_obj);
  __Pyx_XDECREF(__pyx_9genexpr16__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1110
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 * 
 *         if pattern_sort:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_69get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_69get_sort_key = {"get_sort_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_69get_sort_key, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_69get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_pattern_sort = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sort_key (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_pattern_sort,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_sort);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_sort_key") < 0)) __PYX_ERR(0, 1110, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_pattern_sort = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_sort_key", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1110, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_68get_sort_key(__pyx_self, __pyx_v_self, __pyx_v_pattern_sort);

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

/* "mathics/core/expression.py":1147
 *                     0,
 *                     self._head.get_sort_key(True),
 *                     tuple(leaf.get_sort_key(True) for leaf in self._leaves),             # <<<<<<<<<<<<<<
 *                     1,
 *                 ]
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_12get_sort_key_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_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_7mathics_4core_10expression___pyx_scope_struct_16_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_16_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_16_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1147, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *) __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_7mathics_4core_10expression_10Expression_12get_sort_key_2generator7, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Expression_get_sort_key_locals_g, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 1147, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_sort_key.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_7mathics_4core_10expression_10Expression_12get_sort_key_2generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  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, 1147, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1147, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1147, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1147, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1147, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1147, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_leaf);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_leaf, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_leaf, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_5, Py_True);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1147, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_4core_10expression_10Expression_12get_sort_key_5generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/core/expression.py":1205
 *                     tuple(
 *                         chain(
 *                             (leaf.get_sort_key(True) for leaf in self._leaves), ([4],)             # <<<<<<<<<<<<<<
 *                         )
 *                     ),
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_12get_sort_key_3genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_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_7mathics_4core_10expression___pyx_scope_struct_17_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_17_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_17_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1205, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *) __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_7mathics_4core_10expression_10Expression_12get_sort_key_5generator8, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Expression_get_sort_key_locals_g, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_sort_key.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_7mathics_4core_10expression_10Expression_12get_sort_key_5generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  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, 1205, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1205, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1205, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1205, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1205, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1205, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_leaf);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_leaf, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_leaf, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_5, Py_True);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1205, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

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

/* "mathics/core/expression.py":1110
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 * 
 *         if pattern_sort:
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_68get_sort_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_pattern_sort) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *__pyx_cur_scope;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_pattern = NULL;
  PyObject *__pyx_v_sub = NULL;
  PyObject *__pyx_v_min_key = NULL;
  PyObject *__pyx_v_min = NULL;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_exps = NULL;
  PyObject *__pyx_v_head = NULL;
  PyObject *__pyx_v_var = NULL;
  PyObject *__pyx_v_exp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_sort_key", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1110, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);

  /* "mathics/core/expression.py":1112
 *     def get_sort_key(self, pattern_sort=False):
 * 
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             """
 *             Pattern sort key structure:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_sort); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1112, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":1126
 *             """
 * 
 *             name = self._head.get_name()             # <<<<<<<<<<<<<<
 *             pattern = 0
 *             if name == "System`Blank":
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1126, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_name = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1127
 * 
 *             name = self._head.get_name()
 *             pattern = 0             # <<<<<<<<<<<<<<
 *             if name == "System`Blank":
 *                 pattern = 1
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_pattern = __pyx_int_0;

    /* "mathics/core/expression.py":1128
 *             name = self._head.get_name()
 *             pattern = 0
 *             if name == "System`Blank":             # <<<<<<<<<<<<<<
 *                 pattern = 1
 *             elif name == "System`BlankSequence":
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_Blank, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1128, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1129
 *             pattern = 0
 *             if name == "System`Blank":
 *                 pattern = 1             # <<<<<<<<<<<<<<
 *             elif name == "System`BlankSequence":
 *                 pattern = 2
 */
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_DECREF_SET(__pyx_v_pattern, __pyx_int_1);

      /* "mathics/core/expression.py":1128
 *             name = self._head.get_name()
 *             pattern = 0
 *             if name == "System`Blank":             # <<<<<<<<<<<<<<
 *                 pattern = 1
 *             elif name == "System`BlankSequence":
 */
      goto __pyx_L4;
    }

    /* "mathics/core/expression.py":1130
 *             if name == "System`Blank":
 *                 pattern = 1
 *             elif name == "System`BlankSequence":             # <<<<<<<<<<<<<<
 *                 pattern = 2
 *             elif name == "System`BlankNullSequence":
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_BlankSequence, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1130, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1131
 *                 pattern = 1
 *             elif name == "System`BlankSequence":
 *                 pattern = 2             # <<<<<<<<<<<<<<
 *             elif name == "System`BlankNullSequence":
 *                 pattern = 3
 */
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_DECREF_SET(__pyx_v_pattern, __pyx_int_2);

      /* "mathics/core/expression.py":1130
 *             if name == "System`Blank":
 *                 pattern = 1
 *             elif name == "System`BlankSequence":             # <<<<<<<<<<<<<<
 *                 pattern = 2
 *             elif name == "System`BlankNullSequence":
 */
      goto __pyx_L4;
    }

    /* "mathics/core/expression.py":1132
 *             elif name == "System`BlankSequence":
 *                 pattern = 2
 *             elif name == "System`BlankNullSequence":             # <<<<<<<<<<<<<<
 *                 pattern = 3
 *             if pattern > 0:
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_BlankNullSequence, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1132, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1133
 *                 pattern = 2
 *             elif name == "System`BlankNullSequence":
 *                 pattern = 3             # <<<<<<<<<<<<<<
 *             if pattern > 0:
 *                 if self._leaves:
 */
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_DECREF_SET(__pyx_v_pattern, __pyx_int_3);

      /* "mathics/core/expression.py":1132
 *             elif name == "System`BlankSequence":
 *                 pattern = 2
 *             elif name == "System`BlankNullSequence":             # <<<<<<<<<<<<<<
 *                 pattern = 3
 *             if pattern > 0:
 */
    }
    __pyx_L4:;

    /* "mathics/core/expression.py":1134
 *             elif name == "System`BlankNullSequence":
 *                 pattern = 3
 *             if pattern > 0:             # <<<<<<<<<<<<<<
 *                 if self._leaves:
 *                     pattern += 10
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_pattern, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1134, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1134, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1135
 *                 pattern = 3
 *             if pattern > 0:
 *                 if self._leaves:             # <<<<<<<<<<<<<<
 *                     pattern += 10
 *                 else:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1135, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":1136
 *             if pattern > 0:
 *                 if self._leaves:
 *                     pattern += 10             # <<<<<<<<<<<<<<
 *                 else:
 *                     pattern += 20
 */
        __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_pattern, __pyx_int_10, 10, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_pattern, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1135
 *                 pattern = 3
 *             if pattern > 0:
 *                 if self._leaves:             # <<<<<<<<<<<<<<
 *                     pattern += 10
 *                 else:
 */
        goto __pyx_L6;
      }

      /* "mathics/core/expression.py":1138
 *                     pattern += 10
 *                 else:
 *                     pattern += 20             # <<<<<<<<<<<<<<
 *             if pattern > 0:
 *                 return [
 */
      /*else*/ {
        __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_pattern, __pyx_int_20, 20, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF_SET(__pyx_v_pattern, __pyx_t_2);
        __pyx_t_2 = 0;
      }
      __pyx_L6:;

      /* "mathics/core/expression.py":1134
 *             elif name == "System`BlankNullSequence":
 *                 pattern = 3
 *             if pattern > 0:             # <<<<<<<<<<<<<<
 *                 if self._leaves:
 *                     pattern += 10
 */
    }

    /* "mathics/core/expression.py":1139
 *                 else:
 *                     pattern += 20
 *             if pattern > 0:             # <<<<<<<<<<<<<<
 *                 return [
 *                     2,
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_pattern, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1140
 *                     pattern += 20
 *             if pattern > 0:
 *                 return [             # <<<<<<<<<<<<<<
 *                     2,
 *                     pattern,
 */
      __Pyx_XDECREF(__pyx_r);

      /* "mathics/core/expression.py":1146
 *                     1,
 *                     0,
 *                     self._head.get_sort_key(True),             # <<<<<<<<<<<<<<
 *                     tuple(leaf.get_sort_key(True) for leaf in self._leaves),
 *                     1,
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_3, Py_True);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1146, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "mathics/core/expression.py":1147
 *                     0,
 *                     self._head.get_sort_key(True),
 *                     tuple(leaf.get_sort_key(True) for leaf in self._leaves),             # <<<<<<<<<<<<<<
 *                     1,
 *                 ]
 */
      __pyx_t_3 = __pyx_pf_7mathics_4core_10expression_10Expression_12get_sort_key_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "mathics/core/expression.py":1140
 *                     pattern += 20
 *             if pattern > 0:
 *                 return [             # <<<<<<<<<<<<<<
 *                     2,
 *                     pattern,
 */
      __pyx_t_3 = PyList_New(8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1140, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_2);
      __Pyx_INCREF(__pyx_v_pattern);
      __Pyx_GIVEREF(__pyx_v_pattern);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_v_pattern);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_3, 2, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_3, 3, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_3, 4, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_3, 5, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_3, 6, __pyx_t_4);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_3, 7, __pyx_int_1);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1139
 *                 else:
 *                     pattern += 20
 *             if pattern > 0:             # <<<<<<<<<<<<<<
 *                 return [
 *                     2,
 */
    }

    /* "mathics/core/expression.py":1151
 *                 ]
 * 
 *             if name == "System`PatternTest":             # <<<<<<<<<<<<<<
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_PatternTest, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1151, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1152
 * 
 *             if name == "System`PatternTest":
 *                 if len(self._leaves) != 2:             # <<<<<<<<<<<<<<
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1152, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1152, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = ((__pyx_t_5 != 2) != 0);
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":1153
 *             if name == "System`PatternTest":
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]             # <<<<<<<<<<<<<<
 *                 sub = self._leaves[0].get_sort_key(True)
 *                 sub[2] = 0
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = PyList_New(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1153, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_int_3);
        __Pyx_GIVEREF(__pyx_int_3);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 3, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 4, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_t_3);
        PyList_SET_ITEM(__pyx_t_2, 5, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_4);
        PyList_SET_ITEM(__pyx_t_2, 6, __pyx_t_4);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyList_SET_ITEM(__pyx_t_2, 7, __pyx_int_1);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1152
 * 
 *             if name == "System`PatternTest":
 *                 if len(self._leaves) != 2:             # <<<<<<<<<<<<<<
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)
 */
      }

      /* "mathics/core/expression.py":1154
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)             # <<<<<<<<<<<<<<
 *                 sub[2] = 0
 *                 return sub
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_sub = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1155
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)
 *                 sub[2] = 0             # <<<<<<<<<<<<<<
 *                 return sub
 *             elif name == "System`Condition":
 */
      if (unlikely(__Pyx_SetItemInt(__pyx_v_sub, 2, __pyx_int_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 1155, __pyx_L1_error)

      /* "mathics/core/expression.py":1156
 *                 sub = self._leaves[0].get_sort_key(True)
 *                 sub[2] = 0
 *                 return sub             # <<<<<<<<<<<<<<
 *             elif name == "System`Condition":
 *                 if len(self._leaves) != 2:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_sub);
      __pyx_r = __pyx_v_sub;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1151
 *                 ]
 * 
 *             if name == "System`PatternTest":             # <<<<<<<<<<<<<<
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 */
    }

    /* "mathics/core/expression.py":1157
 *                 sub[2] = 0
 *                 return sub
 *             elif name == "System`Condition":             # <<<<<<<<<<<<<<
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_Condition, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1157, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1158
 *                 return sub
 *             elif name == "System`Condition":
 *                 if len(self._leaves) != 2:             # <<<<<<<<<<<<<<
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1158, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1158, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = ((__pyx_t_5 != 2) != 0);
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":1159
 *             elif name == "System`Condition":
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]             # <<<<<<<<<<<<<<
 *                 sub = self._leaves[0].get_sort_key(True)
 *                 sub[7] = 0
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1159, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1159, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PyList_New(8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1159, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_int_3);
        __Pyx_GIVEREF(__pyx_int_3);
        PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_3, 2, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_3, 4, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_t_2);
        PyList_SET_ITEM(__pyx_t_3, 5, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4);
        PyList_SET_ITEM(__pyx_t_3, 6, __pyx_t_4);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyList_SET_ITEM(__pyx_t_3, 7, __pyx_int_1);
        __pyx_t_2 = 0;
        __pyx_t_4 = 0;
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1158
 *                 return sub
 *             elif name == "System`Condition":
 *                 if len(self._leaves) != 2:             # <<<<<<<<<<<<<<
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)
 */
      }

      /* "mathics/core/expression.py":1160
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)             # <<<<<<<<<<<<<<
 *                 sub[7] = 0
 *                 return sub
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1160, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_sub = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":1161
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)
 *                 sub[7] = 0             # <<<<<<<<<<<<<<
 *                 return sub
 *             elif name == "System`Pattern":
 */
      if (unlikely(__Pyx_SetItemInt(__pyx_v_sub, 7, __pyx_int_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 1161, __pyx_L1_error)

      /* "mathics/core/expression.py":1162
 *                 sub = self._leaves[0].get_sort_key(True)
 *                 sub[7] = 0
 *                 return sub             # <<<<<<<<<<<<<<
 *             elif name == "System`Pattern":
 *                 if len(self._leaves) != 2:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_sub);
      __pyx_r = __pyx_v_sub;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1157
 *                 sub[2] = 0
 *                 return sub
 *             elif name == "System`Condition":             # <<<<<<<<<<<<<<
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 */
    }

    /* "mathics/core/expression.py":1163
 *                 sub[7] = 0
 *                 return sub
 *             elif name == "System`Pattern":             # <<<<<<<<<<<<<<
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_Pattern, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1163, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1164
 *                 return sub
 *             elif name == "System`Pattern":
 *                 if len(self._leaves) != 2:             # <<<<<<<<<<<<<<
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[1].get_sort_key(True)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1164, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1164, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = ((__pyx_t_5 != 2) != 0);
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":1165
 *             elif name == "System`Pattern":
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]             # <<<<<<<<<<<<<<
 *                 sub = self._leaves[1].get_sort_key(True)
 *                 sub[3] = 0
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1165, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1165, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = PyList_New(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1165, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_int_3);
        __Pyx_GIVEREF(__pyx_int_3);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 3, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 4, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_t_3);
        PyList_SET_ITEM(__pyx_t_2, 5, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_4);
        PyList_SET_ITEM(__pyx_t_2, 6, __pyx_t_4);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyList_SET_ITEM(__pyx_t_2, 7, __pyx_int_1);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1164
 *                 return sub
 *             elif name == "System`Pattern":
 *                 if len(self._leaves) != 2:             # <<<<<<<<<<<<<<
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[1].get_sort_key(True)
 */
      }

      /* "mathics/core/expression.py":1166
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[1].get_sort_key(True)             # <<<<<<<<<<<<<<
 *                 sub[3] = 0
 *                 return sub
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1166, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1166, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1166, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_sub = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1167
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[1].get_sort_key(True)
 *                 sub[3] = 0             # <<<<<<<<<<<<<<
 *                 return sub
 *             elif name == "System`Optional":
 */
      if (unlikely(__Pyx_SetItemInt(__pyx_v_sub, 3, __pyx_int_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 1167, __pyx_L1_error)

      /* "mathics/core/expression.py":1168
 *                 sub = self._leaves[1].get_sort_key(True)
 *                 sub[3] = 0
 *                 return sub             # <<<<<<<<<<<<<<
 *             elif name == "System`Optional":
 *                 if len(self._leaves) not in (1, 2):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_sub);
      __pyx_r = __pyx_v_sub;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1163
 *                 sub[7] = 0
 *                 return sub
 *             elif name == "System`Pattern":             # <<<<<<<<<<<<<<
 *                 if len(self._leaves) != 2:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 */
    }

    /* "mathics/core/expression.py":1169
 *                 sub[3] = 0
 *                 return sub
 *             elif name == "System`Optional":             # <<<<<<<<<<<<<<
 *                 if len(self._leaves) not in (1, 2):
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_Optional, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1169, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1170
 *                 return sub
 *             elif name == "System`Optional":
 *                 if len(self._leaves) not in (1, 2):             # <<<<<<<<<<<<<<
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1170, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = ((__pyx_t_5 != 1) != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_6 = ((__pyx_t_5 != 2) != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L13_bool_binop_done:;
      __pyx_t_6 = (__pyx_t_1 != 0);
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":1171
 *             elif name == "System`Optional":
 *                 if len(self._leaves) not in (1, 2):
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]             # <<<<<<<<<<<<<<
 *                 sub = self._leaves[0].get_sort_key(True)
 *                 sub[4] = 1
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1171, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1171, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PyList_New(8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1171, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_int_3);
        __Pyx_GIVEREF(__pyx_int_3);
        PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_3, 2, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_3, 4, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_t_2);
        PyList_SET_ITEM(__pyx_t_3, 5, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4);
        PyList_SET_ITEM(__pyx_t_3, 6, __pyx_t_4);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyList_SET_ITEM(__pyx_t_3, 7, __pyx_int_1);
        __pyx_t_2 = 0;
        __pyx_t_4 = 0;
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1170
 *                 return sub
 *             elif name == "System`Optional":
 *                 if len(self._leaves) not in (1, 2):             # <<<<<<<<<<<<<<
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)
 */
      }

      /* "mathics/core/expression.py":1172
 *                 if len(self._leaves) not in (1, 2):
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)             # <<<<<<<<<<<<<<
 *                 sub[4] = 1
 *                 return sub
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_sub = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":1173
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 sub = self._leaves[0].get_sort_key(True)
 *                 sub[4] = 1             # <<<<<<<<<<<<<<
 *                 return sub
 *             elif name == "System`Alternatives":
 */
      if (unlikely(__Pyx_SetItemInt(__pyx_v_sub, 4, __pyx_int_1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 1173, __pyx_L1_error)

      /* "mathics/core/expression.py":1174
 *                 sub = self._leaves[0].get_sort_key(True)
 *                 sub[4] = 1
 *                 return sub             # <<<<<<<<<<<<<<
 *             elif name == "System`Alternatives":
 *                 min_key = [4]
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_sub);
      __pyx_r = __pyx_v_sub;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1169
 *                 sub[3] = 0
 *                 return sub
 *             elif name == "System`Optional":             # <<<<<<<<<<<<<<
 *                 if len(self._leaves) not in (1, 2):
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 */
    }

    /* "mathics/core/expression.py":1175
 *                 sub[4] = 1
 *                 return sub
 *             elif name == "System`Alternatives":             # <<<<<<<<<<<<<<
 *                 min_key = [4]
 *                 min = None
 */
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_Alternatives, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1175, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1176
 *                 return sub
 *             elif name == "System`Alternatives":
 *                 min_key = [4]             # <<<<<<<<<<<<<<
 *                 min = None
 *                 for leaf in self._leaves:
 */
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_int_4);
      __Pyx_GIVEREF(__pyx_int_4);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_4);
      __pyx_v_min_key = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":1177
 *             elif name == "System`Alternatives":
 *                 min_key = [4]
 *                 min = None             # <<<<<<<<<<<<<<
 *                 for leaf in self._leaves:
 *                     key = leaf.get_sort_key(True)
 */
      __Pyx_INCREF(Py_None);
      __pyx_v_min = Py_None;

      /* "mathics/core/expression.py":1178
 *                 min_key = [4]
 *                 min = None
 *                 for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *                     key = leaf.get_sort_key(True)
 *                     if key < min_key:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
        __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1178, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1178, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1178, __pyx_L1_error)
            #else
            __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1178, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          } else {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1178, __pyx_L1_error)
            #else
            __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1178, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          }
        } else {
          __pyx_t_3 = __pyx_t_7(__pyx_t_4);
          if (unlikely(!__pyx_t_3)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1178, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_3);
        }
        __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "mathics/core/expression.py":1179
 *                 min = None
 *                 for leaf in self._leaves:
 *                     key = leaf.get_sort_key(True)             # <<<<<<<<<<<<<<
 *                     if key < min_key:
 *                         min = leaf
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_2, Py_True);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1179, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "mathics/core/expression.py":1180
 *                 for leaf in self._leaves:
 *                     key = leaf.get_sort_key(True)
 *                     if key < min_key:             # <<<<<<<<<<<<<<
 *                         min = leaf
 *                         min_key = key
 */
        __pyx_t_3 = PyObject_RichCompare(__pyx_v_key, __pyx_v_min_key, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1180, __pyx_L1_error)
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1180, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_6) {

          /* "mathics/core/expression.py":1181
 *                     key = leaf.get_sort_key(True)
 *                     if key < min_key:
 *                         min = leaf             # <<<<<<<<<<<<<<
 *                         min_key = key
 *                 if min is None:
 */
          __Pyx_INCREF(__pyx_v_leaf);
          __Pyx_DECREF_SET(__pyx_v_min, __pyx_v_leaf);

          /* "mathics/core/expression.py":1182
 *                     if key < min_key:
 *                         min = leaf
 *                         min_key = key             # <<<<<<<<<<<<<<
 *                 if min is None:
 *                     # empty alternatives -> very restrictive pattern
 */
          __Pyx_INCREF(__pyx_v_key);
          __Pyx_DECREF_SET(__pyx_v_min_key, __pyx_v_key);

          /* "mathics/core/expression.py":1180
 *                 for leaf in self._leaves:
 *                     key = leaf.get_sort_key(True)
 *                     if key < min_key:             # <<<<<<<<<<<<<<
 *                         min = leaf
 *                         min_key = key
 */
        }

        /* "mathics/core/expression.py":1178
 *                 min_key = [4]
 *                 min = None
 *                 for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *                     key = leaf.get_sort_key(True)
 *                     if key < min_key:
 */
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "mathics/core/expression.py":1183
 *                         min = leaf
 *                         min_key = key
 *                 if min is None:             # <<<<<<<<<<<<<<
 *                     # empty alternatives -> very restrictive pattern
 *                     return [2, 1]
 */
      __pyx_t_6 = (__pyx_v_min == Py_None);
      __pyx_t_1 = (__pyx_t_6 != 0);
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":1185
 *                 if min is None:
 *                     # empty alternatives -> very restrictive pattern
 *                     return [2, 1]             # <<<<<<<<<<<<<<
 *                 return min_key
 *             elif name == "System`Verbatim":
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1185, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_int_2);
        __Pyx_GIVEREF(__pyx_int_2);
        PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_2);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_1);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1183
 *                         min = leaf
 *                         min_key = key
 *                 if min is None:             # <<<<<<<<<<<<<<
 *                     # empty alternatives -> very restrictive pattern
 *                     return [2, 1]
 */
      }

      /* "mathics/core/expression.py":1186
 *                     # empty alternatives -> very restrictive pattern
 *                     return [2, 1]
 *                 return min_key             # <<<<<<<<<<<<<<
 *             elif name == "System`Verbatim":
 *                 if len(self._leaves) != 1:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_min_key);
      __pyx_r = __pyx_v_min_key;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1175
 *                 sub[4] = 1
 *                 return sub
 *             elif name == "System`Alternatives":             # <<<<<<<<<<<<<<
 *                 min_key = [4]
 *                 min = None
 */
    }

    /* "mathics/core/expression.py":1187
 *                     return [2, 1]
 *                 return min_key
 *             elif name == "System`Verbatim":             # <<<<<<<<<<<<<<
 *                 if len(self._leaves) != 1:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_Verbatim, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1187, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1188
 *                 return min_key
 *             elif name == "System`Verbatim":
 *                 if len(self._leaves) != 1:             # <<<<<<<<<<<<<<
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 return self._leaves[0].get_sort_key(True)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1188, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1188, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = ((__pyx_t_5 != 1) != 0);
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":1189
 *             elif name == "System`Verbatim":
 *                 if len(self._leaves) != 1:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]             # <<<<<<<<<<<<<<
 *                 return self._leaves[0].get_sort_key(True)
 *             elif name == "System`OptionsPattern":
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyList_New(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_int_3);
        __Pyx_GIVEREF(__pyx_int_3);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 3, __pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyList_SET_ITEM(__pyx_t_2, 4, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_t_4);
        PyList_SET_ITEM(__pyx_t_2, 5, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyList_SET_ITEM(__pyx_t_2, 6, __pyx_t_3);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyList_SET_ITEM(__pyx_t_2, 7, __pyx_int_1);
        __pyx_t_4 = 0;
        __pyx_t_3 = 0;
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1188
 *                 return min_key
 *             elif name == "System`Verbatim":
 *                 if len(self._leaves) != 1:             # <<<<<<<<<<<<<<
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 return self._leaves[0].get_sort_key(True)
 */
      }

      /* "mathics/core/expression.py":1190
 *                 if len(self._leaves) != 1:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 return self._leaves[0].get_sort_key(True)             # <<<<<<<<<<<<<<
 *             elif name == "System`OptionsPattern":
 *                 return [2, 40, 0, 1, 1, 0, self._head, self._leaves, 1]
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_3, Py_True);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1187
 *                     return [2, 1]
 *                 return min_key
 *             elif name == "System`Verbatim":             # <<<<<<<<<<<<<<
 *                 if len(self._leaves) != 1:
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 */
    }

    /* "mathics/core/expression.py":1191
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 return self._leaves[0].get_sort_key(True)
 *             elif name == "System`OptionsPattern":             # <<<<<<<<<<<<<<
 *                 return [2, 40, 0, 1, 1, 0, self._head, self._leaves, 1]
 *             else:
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_OptionsPattern, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1191, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1192
 *                 return self._leaves[0].get_sort_key(True)
 *             elif name == "System`OptionsPattern":
 *                 return [2, 40, 0, 1, 1, 0, self._head, self._leaves, 1]             # <<<<<<<<<<<<<<
 *             else:
 *                 # Append [4] to leaves so that longer expressions have higher
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyList_New(9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_2);
      __Pyx_INCREF(__pyx_int_40);
      __Pyx_GIVEREF(__pyx_int_40);
      PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_40);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_4, 2, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_4, 3, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_4, 4, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_4, 5, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_4, 6, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_4, 7, __pyx_t_3);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_4, 8, __pyx_int_1);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1191
 *                     return [3, 0, 0, 0, 0, self._head, self._leaves, 1]
 *                 return self._leaves[0].get_sort_key(True)
 *             elif name == "System`OptionsPattern":             # <<<<<<<<<<<<<<
 *                 return [2, 40, 0, 1, 1, 0, self._head, self._leaves, 1]
 *             else:
 */
    }

    /* "mathics/core/expression.py":1196
 *                 # Append [4] to leaves so that longer expressions have higher
 *                 # precedence
 *                 return [             # <<<<<<<<<<<<<<
 *                     2,
 *                     0,
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);

      /* "mathics/core/expression.py":1202
 *                     1,
 *                     0,
 *                     self._head.get_sort_key(True),             # <<<<<<<<<<<<<<
 *                     tuple(
 *                         chain(
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1202, __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_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_2, Py_True);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1204
 *                     self._head.get_sort_key(True),
 *                     tuple(
 *                         chain(             # <<<<<<<<<<<<<<
 *                             (leaf.get_sort_key(True) for leaf in self._leaves), ([4],)
 *                         )
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_chain); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "mathics/core/expression.py":1205
 *                     tuple(
 *                         chain(
 *                             (leaf.get_sort_key(True) for leaf in self._leaves), ([4],)             # <<<<<<<<<<<<<<
 *                         )
 *                     ),
 */
      __pyx_t_8 = __pyx_pf_7mathics_4core_10expression_10Expression_12get_sort_key_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_int_4);
      __Pyx_GIVEREF(__pyx_int_4);
      PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_4);
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_10};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_10};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10);
        __pyx_t_8 = 0;
        __pyx_t_10 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "mathics/core/expression.py":1203
 *                     0,
 *                     self._head.get_sort_key(True),
 *                     tuple(             # <<<<<<<<<<<<<<
 *                         chain(
 *                             (leaf.get_sort_key(True) for leaf in self._leaves), ([4],)
 */
      __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1196
 *                 # Append [4] to leaves so that longer expressions have higher
 *                 # precedence
 *                 return [             # <<<<<<<<<<<<<<
 *                     2,
 *                     0,
 */
      __pyx_t_2 = PyList_New(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_2);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_2, 3, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_2, 4, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_2, 5, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_2, 6, __pyx_t_3);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_2, 7, __pyx_int_1);
      __pyx_t_4 = 0;
      __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }

    /* "mathics/core/expression.py":1112
 *     def get_sort_key(self, pattern_sort=False):
 * 
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             """
 *             Pattern sort key structure:
 */
  }

  /* "mathics/core/expression.py":1211
 *                 ]
 *         else:
 *             exps = {}             # <<<<<<<<<<<<<<
 *             head = self._head.get_name()
 *             if head == "System`Times":
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_exps = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1212
 *         else:
 *             exps = {}
 *             head = self._head.get_name()             # <<<<<<<<<<<<<<
 *             if head == "System`Times":
 *                 for leaf in self._leaves:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_head = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1213
 *             exps = {}
 *             head = self._head.get_name()
 *             if head == "System`Times":             # <<<<<<<<<<<<<<
 *                 for leaf in self._leaves:
 *                     name = leaf.get_name()
 */
    __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_head, __pyx_kp_u_System_Times, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1213, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1214
 *             head = self._head.get_name()
 *             if head == "System`Times":
 *                 for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *                     name = leaf.get_name()
 *                     if leaf.has_form("Power", 2):
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1214, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
        __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1214, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1214, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_4))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1214, __pyx_L1_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1214, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          } else {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1214, __pyx_L1_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1214, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          }
        } else {
          __pyx_t_2 = __pyx_t_7(__pyx_t_4);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1214, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1215
 *             if head == "System`Times":
 *                 for leaf in self._leaves:
 *                     name = leaf.get_name()             # <<<<<<<<<<<<<<
 *                     if leaf.has_form("Power", 2):
 *                         var = leaf._leaves[0].get_name()
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_get_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1215, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1215, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1216
 *                 for leaf in self._leaves:
 *                     name = leaf.get_name()
 *                     if leaf.has_form("Power", 2):             # <<<<<<<<<<<<<<
 *                         var = leaf._leaves[0].get_name()
 *                         exp = leaf._leaves[1].round_to_float()
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_has_form); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1216, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1216, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1216, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_1) {

          /* "mathics/core/expression.py":1217
 *                     name = leaf.get_name()
 *                     if leaf.has_form("Power", 2):
 *                         var = leaf._leaves[0].get_name()             # <<<<<<<<<<<<<<
 *                         exp = leaf._leaves[1].round_to_float()
 *                         if var and exp is not None:
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1217, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1217, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_get_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1217, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1217, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF_SET(__pyx_v_var, __pyx_t_3);
          __pyx_t_3 = 0;

          /* "mathics/core/expression.py":1218
 *                     if leaf.has_form("Power", 2):
 *                         var = leaf._leaves[0].get_name()
 *                         exp = leaf._leaves[1].round_to_float()             # <<<<<<<<<<<<<<
 *                         if var and exp is not None:
 *                             exps[var] = exps.get(var, 0) + exp
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1218, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1218, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_round_to_float); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1218, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1218, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF_SET(__pyx_v_exp, __pyx_t_3);
          __pyx_t_3 = 0;

          /* "mathics/core/expression.py":1219
 *                         var = leaf._leaves[0].get_name()
 *                         exp = leaf._leaves[1].round_to_float()
 *                         if var and exp is not None:             # <<<<<<<<<<<<<<
 *                             exps[var] = exps.get(var, 0) + exp
 *                     elif name:
 */
          __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_var); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1219, __pyx_L1_error)
          if (__pyx_t_6) {
          } else {
            __pyx_t_1 = __pyx_t_6;
            goto __pyx_L25_bool_binop_done;
          }
          __pyx_t_6 = (__pyx_v_exp != Py_None);
          __pyx_t_13 = (__pyx_t_6 != 0);
          __pyx_t_1 = __pyx_t_13;
          __pyx_L25_bool_binop_done:;
          if (__pyx_t_1) {

            /* "mathics/core/expression.py":1220
 *                         exp = leaf._leaves[1].round_to_float()
 *                         if var and exp is not None:
 *                             exps[var] = exps.get(var, 0) + exp             # <<<<<<<<<<<<<<
 *                     elif name:
 *                         exps[name] = exps.get(name, 0) + 1
 */
            __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_exps, __pyx_v_var, __pyx_int_0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1220, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_exp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1220, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(PyDict_SetItem(__pyx_v_exps, __pyx_v_var, __pyx_t_2) < 0)) __PYX_ERR(0, 1220, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "mathics/core/expression.py":1219
 *                         var = leaf._leaves[0].get_name()
 *                         exp = leaf._leaves[1].round_to_float()
 *                         if var and exp is not None:             # <<<<<<<<<<<<<<
 *                             exps[var] = exps.get(var, 0) + exp
 *                     elif name:
 */
          }

          /* "mathics/core/expression.py":1216
 *                 for leaf in self._leaves:
 *                     name = leaf.get_name()
 *                     if leaf.has_form("Power", 2):             # <<<<<<<<<<<<<<
 *                         var = leaf._leaves[0].get_name()
 *                         exp = leaf._leaves[1].round_to_float()
 */
          goto __pyx_L23;
        }

        /* "mathics/core/expression.py":1221
 *                         if var and exp is not None:
 *                             exps[var] = exps.get(var, 0) + exp
 *                     elif name:             # <<<<<<<<<<<<<<
 *                         exps[name] = exps.get(name, 0) + 1
 *             elif self.has_form("Power", 2):
 */
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1221, __pyx_L1_error)
        if (__pyx_t_1) {

          /* "mathics/core/expression.py":1222
 *                             exps[var] = exps.get(var, 0) + exp
 *                     elif name:
 *                         exps[name] = exps.get(name, 0) + 1             # <<<<<<<<<<<<<<
 *             elif self.has_form("Power", 2):
 *                 var = self._leaves[0].get_name()
 */
          __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_exps, __pyx_v_name, __pyx_int_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1222, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1222, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(PyDict_SetItem(__pyx_v_exps, __pyx_v_name, __pyx_t_3) < 0)) __PYX_ERR(0, 1222, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "mathics/core/expression.py":1221
 *                         if var and exp is not None:
 *                             exps[var] = exps.get(var, 0) + exp
 *                     elif name:             # <<<<<<<<<<<<<<
 *                         exps[name] = exps.get(name, 0) + 1
 *             elif self.has_form("Power", 2):
 */
        }
        __pyx_L23:;

        /* "mathics/core/expression.py":1214
 *             head = self._head.get_name()
 *             if head == "System`Times":
 *                 for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *                     name = leaf.get_name()
 *                     if leaf.has_form("Power", 2):
 */
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "mathics/core/expression.py":1213
 *             exps = {}
 *             head = self._head.get_name()
 *             if head == "System`Times":             # <<<<<<<<<<<<<<
 *                 for leaf in self._leaves:
 *                     name = leaf.get_name()
 */
      goto __pyx_L20;
    }

    /* "mathics/core/expression.py":1223
 *                     elif name:
 *                         exps[name] = exps.get(name, 0) + 1
 *             elif self.has_form("Power", 2):             # <<<<<<<<<<<<<<
 *                 var = self._leaves[0].get_name()
 *                 exp = self._leaves[1].round_to_float()
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_has_form); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1223, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1223, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1224
 *                         exps[name] = exps.get(name, 0) + 1
 *             elif self.has_form("Power", 2):
 *                 var = self._leaves[0].get_name()             # <<<<<<<<<<<<<<
 *                 exp = self._leaves[1].round_to_float()
 *                 if var and exp is not None:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); 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;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_var = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":1225
 *             elif self.has_form("Power", 2):
 *                 var = self._leaves[0].get_name()
 *                 exp = self._leaves[1].round_to_float()             # <<<<<<<<<<<<<<
 *                 if var and exp is not None:
 *                     exps[var] = exps.get(var, 0) + exp
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1225, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1225, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_round_to_float); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1225, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1225, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_exp = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":1226
 *                 var = self._leaves[0].get_name()
 *                 exp = self._leaves[1].round_to_float()
 *                 if var and exp is not None:             # <<<<<<<<<<<<<<
 *                     exps[var] = exps.get(var, 0) + exp
 *             if exps:
 */
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_var); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1226, __pyx_L1_error)
      if (__pyx_t_13) {
      } else {
        __pyx_t_1 = __pyx_t_13;
        goto __pyx_L28_bool_binop_done;
      }
      __pyx_t_13 = (__pyx_v_exp != Py_None);
      __pyx_t_6 = (__pyx_t_13 != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L28_bool_binop_done:;
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":1227
 *                 exp = self._leaves[1].round_to_float()
 *                 if var and exp is not None:
 *                     exps[var] = exps.get(var, 0) + exp             # <<<<<<<<<<<<<<
 *             if exps:
 *                 return [
 */
        __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_exps, __pyx_v_var, __pyx_int_0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1227, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_exp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1227, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(PyDict_SetItem(__pyx_v_exps, __pyx_v_var, __pyx_t_4) < 0)) __PYX_ERR(0, 1227, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "mathics/core/expression.py":1226
 *                 var = self._leaves[0].get_name()
 *                 exp = self._leaves[1].round_to_float()
 *                 if var and exp is not None:             # <<<<<<<<<<<<<<
 *                     exps[var] = exps.get(var, 0) + exp
 *             if exps:
 */
      }

      /* "mathics/core/expression.py":1223
 *                     elif name:
 *                         exps[name] = exps.get(name, 0) + 1
 *             elif self.has_form("Power", 2):             # <<<<<<<<<<<<<<
 *                 var = self._leaves[0].get_name()
 *                 exp = self._leaves[1].round_to_float()
 */
    }
    __pyx_L20:;

    /* "mathics/core/expression.py":1228
 *                 if var and exp is not None:
 *                     exps[var] = exps.get(var, 0) + exp
 *             if exps:             # <<<<<<<<<<<<<<
 *                 return [
 *                     1 if self.is_numeric() else 2,
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_exps); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1228, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1229
 *                     exps[var] = exps.get(var, 0) + exp
 *             if exps:
 *                 return [             # <<<<<<<<<<<<<<
 *                     1 if self.is_numeric() else 2,
 *                     2,
 */
      __Pyx_XDECREF(__pyx_r);

      /* "mathics/core/expression.py":1230
 *             if exps:
 *                 return [
 *                     1 if self.is_numeric() else 2,             # <<<<<<<<<<<<<<
 *                     2,
 *                     Monomial(exps),
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1230, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_int_1);
        __pyx_t_4 = __pyx_int_1;
      } else {
        __Pyx_INCREF(__pyx_int_2);
        __pyx_t_4 = __pyx_int_2;
      }

      /* "mathics/core/expression.py":1232
 *                     1 if self.is_numeric() else 2,
 *                     2,
 *                     Monomial(exps),             # <<<<<<<<<<<<<<
 *                     1,
 *                     self._head,
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Monomial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_12, __pyx_v_exps) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_exps);
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1232, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1234
 *                     Monomial(exps),
 *                     1,
 *                     self._head,             # <<<<<<<<<<<<<<
 *                     self._leaves,
 *                     1,
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "mathics/core/expression.py":1235
 *                     1,
 *                     self._head,
 *                     self._leaves,             # <<<<<<<<<<<<<<
 *                     1,
 *                 ]
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1235, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);

      /* "mathics/core/expression.py":1229
 *                     exps[var] = exps.get(var, 0) + exp
 *             if exps:
 *                 return [             # <<<<<<<<<<<<<<
 *                     1 if self.is_numeric() else 2,
 *                     2,
 */
      __pyx_t_10 = PyList_New(7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1229, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyList_SET_ITEM(__pyx_t_10, 1, __pyx_int_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_10, 2, __pyx_t_3);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_10, 3, __pyx_int_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_10, 4, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_12);
      PyList_SET_ITEM(__pyx_t_10, 5, __pyx_t_12);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_10, 6, __pyx_int_1);
      __pyx_t_4 = 0;
      __pyx_t_3 = 0;
      __pyx_t_2 = 0;
      __pyx_t_12 = 0;
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1228
 *                 if var and exp is not None:
 *                     exps[var] = exps.get(var, 0) + exp
 *             if exps:             # <<<<<<<<<<<<<<
 *                 return [
 *                     1 if self.is_numeric() else 2,
 */
    }

    /* "mathics/core/expression.py":1239
 *                 ]
 *             else:
 *                 return [1 if self.is_numeric() else 2, 3, self._head, self._leaves, 1]             # <<<<<<<<<<<<<<
 * 
 *     def sameQ(self, other) -> bool:
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __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_12 = (__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_12)) __PYX_ERR(0, 1239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1239, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_int_1);
        __pyx_t_10 = __pyx_int_1;
      } else {
        __Pyx_INCREF(__pyx_int_2);
        __pyx_t_10 = __pyx_int_2;
      }
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyList_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1239, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_10);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_10);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_3);
      __Pyx_GIVEREF(__pyx_t_12);
      PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_3, 4, __pyx_int_1);
      __pyx_t_10 = 0;
      __pyx_t_12 = 0;
      __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;
    }
  }

  /* "mathics/core/expression.py":1110
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 * 
 *         if pattern_sort:
 */

  /* 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_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_pattern);
  __Pyx_XDECREF(__pyx_v_sub);
  __Pyx_XDECREF(__pyx_v_min_key);
  __Pyx_XDECREF(__pyx_v_min);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_exps);
  __Pyx_XDECREF(__pyx_v_head);
  __Pyx_XDECREF(__pyx_v_var);
  __Pyx_XDECREF(__pyx_v_exp);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1241
 *                 return [1 if self.is_numeric() else 2, 3, self._head, self._leaves, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if id(self) == id(other):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_71sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_10Expression_70sameQ[] = "Mathics SameQ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_71sameQ = {"sameQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_71sameQ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_10Expression_70sameQ};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_71sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sameQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, 1); __PYX_ERR(0, 1241, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sameQ") < 0)) __PYX_ERR(0, 1241, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1241, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_70sameQ(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_70sameQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("sameQ", 0);
  __Pyx_INCREF(__pyx_v_other);

  /* "mathics/core/expression.py":1243
 *     def sameQ(self, other) -> bool:
 *         """Mathics SameQ"""
 *         if id(self) == id(other):             # <<<<<<<<<<<<<<
 *             return True
 *         if self.get_head_name() != other.get_head_name():
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_other); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1244
 *         """Mathics SameQ"""
 *         if id(self) == id(other):
 *             return True             # <<<<<<<<<<<<<<
 *         if self.get_head_name() != other.get_head_name():
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1243
 *     def sameQ(self, other) -> bool:
 *         """Mathics SameQ"""
 *         if id(self) == id(other):             # <<<<<<<<<<<<<<
 *             return True
 *         if self.get_head_name() != other.get_head_name():
 */
  }

  /* "mathics/core/expression.py":1245
 *         if id(self) == id(other):
 *             return True
 *         if self.get_head_name() != other.get_head_name():             # <<<<<<<<<<<<<<
 *             return False
 *         if not self._head.sameQ(other.get_head()):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1245, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1246
 *             return True
 *         if self.get_head_name() != other.get_head_name():
 *             return False             # <<<<<<<<<<<<<<
 *         if not self._head.sameQ(other.get_head()):
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1245
 *         if id(self) == id(other):
 *             return True
 *         if self.get_head_name() != other.get_head_name():             # <<<<<<<<<<<<<<
 *             return False
 *         if not self._head.sameQ(other.get_head()):
 */
  }

  /* "mathics/core/expression.py":1247
 *         if self.get_head_name() != other.get_head_name():
 *             return False
 *         if not self._head.sameQ(other.get_head()):             # <<<<<<<<<<<<<<
 *             return False
 *         if len(self._leaves) != len(other.get_leaves()):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_head); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1247, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = ((!__pyx_t_4) != 0);
  if (__pyx_t_7) {

    /* "mathics/core/expression.py":1248
 *             return False
 *         if not self._head.sameQ(other.get_head()):
 *             return False             # <<<<<<<<<<<<<<
 *         if len(self._leaves) != len(other.get_leaves()):
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1247
 *         if self.get_head_name() != other.get_head_name():
 *             return False
 *         if not self._head.sameQ(other.get_head()):             # <<<<<<<<<<<<<<
 *             return False
 *         if len(self._leaves) != len(other.get_leaves()):
 */
  }

  /* "mathics/core/expression.py":1249
 *         if not self._head.sameQ(other.get_head()):
 *             return False
 *         if len(self._leaves) != len(other.get_leaves()):             # <<<<<<<<<<<<<<
 *             return False
 *         for leaf, other in zip(self._leaves, other.get_leaves()):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_leaves); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1249, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = ((__pyx_t_8 != __pyx_t_9) != 0);
  if (__pyx_t_7) {

    /* "mathics/core/expression.py":1250
 *             return False
 *         if len(self._leaves) != len(other.get_leaves()):
 *             return False             # <<<<<<<<<<<<<<
 *         for leaf, other in zip(self._leaves, other.get_leaves()):
 *             if not leaf.sameQ(other):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1249
 *         if not self._head.sameQ(other.get_head()):
 *             return False
 *         if len(self._leaves) != len(other.get_leaves()):             # <<<<<<<<<<<<<<
 *             return False
 *         for leaf, other in zip(self._leaves, other.get_leaves()):
 */
  }

  /* "mathics/core/expression.py":1251
 *         if len(self._leaves) != len(other.get_leaves()):
 *             return False
 *         for leaf, other in zip(self._leaves, other.get_leaves()):             # <<<<<<<<<<<<<<
 *             if not leaf.sameQ(other):
 *                 return False
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1251, __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_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1251, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1251, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1251, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1251, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1251, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_10(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1251, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      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, 1251, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_5 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_6), 2) < 0) __PYX_ERR(0, 1251, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L10_unpacking_done;
      __pyx_L9_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1251, __pyx_L1_error)
      __pyx_L10_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_other, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "mathics/core/expression.py":1252
 *             return False
 *         for leaf, other in zip(self._leaves, other.get_leaves()):
 *             if not leaf.sameQ(other):             # <<<<<<<<<<<<<<
 *                 return False
 *         return True
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_other) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_other);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_4 = ((!__pyx_t_7) != 0);
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":1253
 *         for leaf, other in zip(self._leaves, other.get_leaves()):
 *             if not leaf.sameQ(other):
 *                 return False             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1252
 *             return False
 *         for leaf, other in zip(self._leaves, other.get_leaves()):
 *             if not leaf.sameQ(other):             # <<<<<<<<<<<<<<
 *                 return False
 *         return True
 */
    }

    /* "mathics/core/expression.py":1251
 *         if len(self._leaves) != len(other.get_leaves()):
 *             return False
 *         for leaf, other in zip(self._leaves, other.get_leaves()):             # <<<<<<<<<<<<<<
 *             if not leaf.sameQ(other):
 *                 return False
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1254
 *             if not leaf.sameQ(other):
 *                 return False
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def flatten(
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1241
 *                 return [1 if self.is_numeric() else 2, 3, self._head, self._leaves, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if id(self) == id(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_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.Expression.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_v_other);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1256
 *         return True
 * 
 *     def flatten(             # <<<<<<<<<<<<<<
 *         self, head, pattern_only=False, callback=None, level=None
 *     ) -> "Expression":
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_73flatten(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_73flatten = {"flatten", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_73flatten, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_73flatten(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_head = 0;
  PyObject *__pyx_v_pattern_only = 0;
  PyObject *__pyx_v_callback = 0;
  PyObject *__pyx_v_level = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flatten (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_head,&__pyx_n_s_pattern_only,&__pyx_n_s_callback,&__pyx_n_s_level,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "mathics/core/expression.py":1257
 * 
 *     def flatten(
 *         self, head, pattern_only=False, callback=None, level=None             # <<<<<<<<<<<<<<
 *     ) -> "Expression":
 *         if level is not None and level <= 0:
 */
    values[2] = ((PyObject *)((PyObject *)Py_False));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_head)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("flatten", 0, 2, 5, 1); __PYX_ERR(0, 1256, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_only);
          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_callback);
          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_level);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flatten") < 0)) __PYX_ERR(0, 1256, __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_self = values[0];
    __pyx_v_head = values[1];
    __pyx_v_pattern_only = values[2];
    __pyx_v_callback = values[3];
    __pyx_v_level = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("flatten", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1256, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.flatten", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_72flatten(__pyx_self, __pyx_v_self, __pyx_v_head, __pyx_v_pattern_only, __pyx_v_callback, __pyx_v_level);

  /* "mathics/core/expression.py":1256
 *         return True
 * 
 *     def flatten(             # <<<<<<<<<<<<<<
 *         self, head, pattern_only=False, callback=None, level=None
 *     ) -> "Expression":
 */

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_72flatten(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head, PyObject *__pyx_v_pattern_only, PyObject *__pyx_v_callback, PyObject *__pyx_v_level) {
  PyObject *__pyx_v_sub_level = NULL;
  int __pyx_v_do_flatten;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_v_new_leaves = NULL;
  PyObject *__pyx_v_new_leaf = 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;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("flatten", 0);

  /* "mathics/core/expression.py":1259
 *         self, head, pattern_only=False, callback=None, level=None
 *     ) -> "Expression":
 *         if level is not None and level <= 0:             # <<<<<<<<<<<<<<
 *             return self
 *         if self._no_symbol(head.get_name()):
 */
  __pyx_t_2 = (__pyx_v_level != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_level, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1259, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":1260
 *     ) -> "Expression":
 *         if level is not None and level <= 0:
 *             return self             # <<<<<<<<<<<<<<
 *         if self._no_symbol(head.get_name()):
 *             return self
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1259
 *         self, head, pattern_only=False, callback=None, level=None
 *     ) -> "Expression":
 *         if level is not None and level <= 0:             # <<<<<<<<<<<<<<
 *             return self
 *         if self._no_symbol(head.get_name()):
 */
  }

  /* "mathics/core/expression.py":1261
 *         if level is not None and level <= 0:
 *             return self
 *         if self._no_symbol(head.get_name()):             # <<<<<<<<<<<<<<
 *             return self
 *         sub_level = None if level is None else level - 1
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_no_symbol); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_head, __pyx_n_s_get_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1261, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":1262
 *             return self
 *         if self._no_symbol(head.get_name()):
 *             return self             # <<<<<<<<<<<<<<
 *         sub_level = None if level is None else level - 1
 *         do_flatten = False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1261
 *         if level is not None and level <= 0:
 *             return self
 *         if self._no_symbol(head.get_name()):             # <<<<<<<<<<<<<<
 *             return self
 *         sub_level = None if level is None else level - 1
 */
  }

  /* "mathics/core/expression.py":1263
 *         if self._no_symbol(head.get_name()):
 *             return self
 *         sub_level = None if level is None else level - 1             # <<<<<<<<<<<<<<
 *         do_flatten = False
 *         for leaf in self._leaves:
 */
  __pyx_t_1 = (__pyx_v_level == Py_None);
  if ((__pyx_t_1 != 0)) {
    __Pyx_INCREF(Py_None);
    __pyx_t_4 = Py_None;
  } else {
    __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_level, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_v_sub_level = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1264
 *             return self
 *         sub_level = None if level is None else level - 1
 *         do_flatten = False             # <<<<<<<<<<<<<<
 *         for leaf in self._leaves:
 *             if leaf.get_head().sameQ(head) and (
 */
  __pyx_v_do_flatten = 0;

  /* "mathics/core/expression.py":1265
 *         sub_level = None if level is None else level - 1
 *         do_flatten = False
 *         for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *             if leaf.get_head().sameQ(head) and (
 *                 not pattern_only or leaf.pattern_sequence
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1265, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1265, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1265, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1265, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1265, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1265, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_10(__pyx_t_5);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1265, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1266
 *         do_flatten = False
 *         for leaf in self._leaves:
 *             if leaf.get_head().sameQ(head) and (             # <<<<<<<<<<<<<<
 *                 not pattern_only or leaf.pattern_sequence
 *             ):
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_get_head); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_head);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1266, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L10_bool_binop_done;
    }

    /* "mathics/core/expression.py":1267
 *         for leaf in self._leaves:
 *             if leaf.get_head().sameQ(head) and (
 *                 not pattern_only or leaf.pattern_sequence             # <<<<<<<<<<<<<<
 *             ):
 *                 do_flatten = True
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_only); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1267, __pyx_L1_error)
    __pyx_t_2 = ((!__pyx_t_3) != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_pattern_sequence); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1267, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_L10_bool_binop_done:;

    /* "mathics/core/expression.py":1266
 *         do_flatten = False
 *         for leaf in self._leaves:
 *             if leaf.get_head().sameQ(head) and (             # <<<<<<<<<<<<<<
 *                 not pattern_only or leaf.pattern_sequence
 *             ):
 */
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":1269
 *                 not pattern_only or leaf.pattern_sequence
 *             ):
 *                 do_flatten = True             # <<<<<<<<<<<<<<
 *                 break
 *         if do_flatten:
 */
      __pyx_v_do_flatten = 1;

      /* "mathics/core/expression.py":1270
 *             ):
 *                 do_flatten = True
 *                 break             # <<<<<<<<<<<<<<
 *         if do_flatten:
 *             new_leaves = []
 */
      goto __pyx_L8_break;

      /* "mathics/core/expression.py":1266
 *         do_flatten = False
 *         for leaf in self._leaves:
 *             if leaf.get_head().sameQ(head) and (             # <<<<<<<<<<<<<<
 *                 not pattern_only or leaf.pattern_sequence
 *             ):
 */
    }

    /* "mathics/core/expression.py":1265
 *         sub_level = None if level is None else level - 1
 *         do_flatten = False
 *         for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *             if leaf.get_head().sameQ(head) and (
 *                 not pattern_only or leaf.pattern_sequence
 */
  }
  __pyx_L8_break:;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1271
 *                 do_flatten = True
 *                 break
 *         if do_flatten:             # <<<<<<<<<<<<<<
 *             new_leaves = []
 *             for leaf in self._leaves:
 */
  __pyx_t_1 = (__pyx_v_do_flatten != 0);
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":1272
 *                 break
 *         if do_flatten:
 *             new_leaves = []             # <<<<<<<<<<<<<<
 *             for leaf in self._leaves:
 *                 if leaf.get_head().sameQ(head) and (
 */
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_v_new_leaves = ((PyObject*)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "mathics/core/expression.py":1273
 *         if do_flatten:
 *             new_leaves = []
 *             for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *                 if leaf.get_head().sameQ(head) and (
 *                     not pattern_only or leaf.pattern_sequence
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1273, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1273, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1273, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1273, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1273, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_10(__pyx_t_4);
        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, 1273, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "mathics/core/expression.py":1274
 *             new_leaves = []
 *             for leaf in self._leaves:
 *                 if leaf.get_head().sameQ(head) and (             # <<<<<<<<<<<<<<
 *                     not pattern_only or leaf.pattern_sequence
 *                 ):
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_get_head); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_7 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_head);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1274, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L17_bool_binop_done;
      }

      /* "mathics/core/expression.py":1275
 *             for leaf in self._leaves:
 *                 if leaf.get_head().sameQ(head) and (
 *                     not pattern_only or leaf.pattern_sequence             # <<<<<<<<<<<<<<
 *                 ):
 *                     new_leaf = leaf.flatten(
 */
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_only); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1275, __pyx_L1_error)
      __pyx_t_3 = ((!__pyx_t_2) != 0);
      if (!__pyx_t_3) {
      } else {
        __pyx_t_1 = __pyx_t_3;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_pattern_sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1275, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __pyx_t_3;
      __pyx_L17_bool_binop_done:;

      /* "mathics/core/expression.py":1274
 *             new_leaves = []
 *             for leaf in self._leaves:
 *                 if leaf.get_head().sameQ(head) and (             # <<<<<<<<<<<<<<
 *                     not pattern_only or leaf.pattern_sequence
 *                 ):
 */
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":1277
 *                     not pattern_only or leaf.pattern_sequence
 *                 ):
 *                     new_leaf = leaf.flatten(             # <<<<<<<<<<<<<<
 *                         head, pattern_only, callback, level=sub_level
 *                     )
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_flatten); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1277, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);

        /* "mathics/core/expression.py":1278
 *                 ):
 *                     new_leaf = leaf.flatten(
 *                         head, pattern_only, callback, level=sub_level             # <<<<<<<<<<<<<<
 *                     )
 *                     if callback is not None:
 */
        __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1277, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_head);
        __Pyx_GIVEREF(__pyx_v_head);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_head);
        __Pyx_INCREF(__pyx_v_pattern_only);
        __Pyx_GIVEREF(__pyx_v_pattern_only);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_pattern_only);
        __Pyx_INCREF(__pyx_v_callback);
        __Pyx_GIVEREF(__pyx_v_callback);
        PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_callback);
        __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1278, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_level, __pyx_v_sub_level) < 0) __PYX_ERR(0, 1278, __pyx_L1_error)

        /* "mathics/core/expression.py":1277
 *                     not pattern_only or leaf.pattern_sequence
 *                 ):
 *                     new_leaf = leaf.flatten(             # <<<<<<<<<<<<<<
 *                         head, pattern_only, callback, level=sub_level
 *                     )
 */
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1277, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF_SET(__pyx_v_new_leaf, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "mathics/core/expression.py":1280
 *                         head, pattern_only, callback, level=sub_level
 *                     )
 *                     if callback is not None:             # <<<<<<<<<<<<<<
 *                         callback(new_leaf._leaves, leaf)
 *                     new_leaves.extend(new_leaf._leaves)
 */
        __pyx_t_1 = (__pyx_v_callback != Py_None);
        __pyx_t_3 = (__pyx_t_1 != 0);
        if (__pyx_t_3) {

          /* "mathics/core/expression.py":1281
 *                     )
 *                     if callback is not None:
 *                         callback(new_leaf._leaves, leaf)             # <<<<<<<<<<<<<<
 *                     new_leaves.extend(new_leaf._leaves)
 *                 else:
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_leaf, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1281, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_v_callback);
          __pyx_t_6 = __pyx_v_callback; __pyx_t_5 = NULL;
          __pyx_t_11 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
              __pyx_t_11 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_v_leaf};
            __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1281, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_v_leaf};
            __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1281, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else
          #endif
          {
            __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1281, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            if (__pyx_t_5) {
              __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5); __pyx_t_5 = NULL;
            }
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_7);
            __Pyx_INCREF(__pyx_v_leaf);
            __Pyx_GIVEREF(__pyx_v_leaf);
            PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_leaf);
            __pyx_t_7 = 0;
            __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1281, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "mathics/core/expression.py":1280
 *                         head, pattern_only, callback, level=sub_level
 *                     )
 *                     if callback is not None:             # <<<<<<<<<<<<<<
 *                         callback(new_leaf._leaves, leaf)
 *                     new_leaves.extend(new_leaf._leaves)
 */
        }

        /* "mathics/core/expression.py":1282
 *                     if callback is not None:
 *                         callback(new_leaf._leaves, leaf)
 *                     new_leaves.extend(new_leaf._leaves)             # <<<<<<<<<<<<<<
 *                 else:
 *                     new_leaves.append(leaf)
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_leaf, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1282, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_13 = __Pyx_PyList_Extend(__pyx_v_new_leaves, __pyx_t_8); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1282, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "mathics/core/expression.py":1274
 *             new_leaves = []
 *             for leaf in self._leaves:
 *                 if leaf.get_head().sameQ(head) and (             # <<<<<<<<<<<<<<
 *                     not pattern_only or leaf.pattern_sequence
 *                 ):
 */
        goto __pyx_L16;
      }

      /* "mathics/core/expression.py":1284
 *                     new_leaves.extend(new_leaf._leaves)
 *                 else:
 *                     new_leaves.append(leaf)             # <<<<<<<<<<<<<<
 *             return Expression(self._head, *new_leaves)
 *         else:
 */
      /*else*/ {
        __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_new_leaves, __pyx_v_leaf); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1284, __pyx_L1_error)
      }
      __pyx_L16:;

      /* "mathics/core/expression.py":1273
 *         if do_flatten:
 *             new_leaves = []
 *             for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *                 if leaf.get_head().sameQ(head) and (
 *                     not pattern_only or leaf.pattern_sequence
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1285
 *                 else:
 *                     new_leaves.append(leaf)
 *             return Expression(self._head, *new_leaves)             # <<<<<<<<<<<<<<
 *         else:
 *             return self
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = PySequence_Tuple(__pyx_v_new_leaves); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_12 = PyNumber_Add(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1271
 *                 do_flatten = True
 *                 break
 *         if do_flatten:             # <<<<<<<<<<<<<<
 *             new_leaves = []
 *             for leaf in self._leaves:
 */
  }

  /* "mathics/core/expression.py":1287
 *             return Expression(self._head, *new_leaves)
 *         else:
 *             return self             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, evaluation) -> typing.Union["Expression", "Symbol"]:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":1256
 *         return True
 * 
 *     def flatten(             # <<<<<<<<<<<<<<
 *         self, head, pattern_only=False, callback=None, level=None
 *     ) -> "Expression":
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("mathics.core.expression.Expression.flatten", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sub_level);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_v_new_leaves);
  __Pyx_XDECREF(__pyx_v_new_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1289
 *             return self
 * 
 *     def evaluate(self, evaluation) -> typing.Union["Expression", "Symbol"]:             # <<<<<<<<<<<<<<
 *         from mathics.core.evaluation import ReturnInterrupt
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_75evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_75evaluate = {"evaluate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_75evaluate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_75evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); __PYX_ERR(0, 1289, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) __PYX_ERR(0, 1289, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1289, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_74evaluate(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_74evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_ReturnInterrupt = NULL;
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_v_reevaluate = NULL;
  PyObject *__pyx_v_limit = NULL;
  PyObject *__pyx_v_iteration = NULL;
  PyObject *__pyx_v_names = NULL;
  PyObject *__pyx_v_definitions = NULL;
  PyObject *__pyx_v_old_options = NULL;
  PyObject *__pyx_v_ret = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  char const *__pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  char const *__pyx_t_24;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate", 0);

  /* "mathics/core/expression.py":1290
 * 
 *     def evaluate(self, evaluation) -> typing.Union["Expression", "Symbol"]:
 *         from mathics.core.evaluation import ReturnInterrupt             # <<<<<<<<<<<<<<
 * 
 *         if evaluation.timeout:
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_ReturnInterrupt);
  __Pyx_GIVEREF(__pyx_n_s_ReturnInterrupt);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ReturnInterrupt);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_core_evaluation, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1290, __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_ReturnInterrupt); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_ReturnInterrupt = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1292
 *         from mathics.core.evaluation import ReturnInterrupt
 * 
 *         if evaluation.timeout:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_timeout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":1293
 * 
 *         if evaluation.timeout:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         expr = self
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/core/expression.py":1292
 *         from mathics.core.evaluation import ReturnInterrupt
 * 
 *         if evaluation.timeout:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "mathics/core/expression.py":1295
 *             return
 * 
 *         expr = self             # <<<<<<<<<<<<<<
 *         reevaluate = True
 *         limit = None
 */
  __Pyx_INCREF(__pyx_v_self);
  __pyx_v_expr = __pyx_v_self;

  /* "mathics/core/expression.py":1296
 * 
 *         expr = self
 *         reevaluate = True             # <<<<<<<<<<<<<<
 *         limit = None
 *         iteration = 1
 */
  __Pyx_INCREF(Py_True);
  __pyx_v_reevaluate = Py_True;

  /* "mathics/core/expression.py":1297
 *         expr = self
 *         reevaluate = True
 *         limit = None             # <<<<<<<<<<<<<<
 *         iteration = 1
 *         names = set()
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_limit = Py_None;

  /* "mathics/core/expression.py":1298
 *         reevaluate = True
 *         limit = None
 *         iteration = 1             # <<<<<<<<<<<<<<
 *         names = set()
 *         definitions = evaluation.definitions
 */
  __Pyx_INCREF(__pyx_int_1);
  __pyx_v_iteration = __pyx_int_1;

  /* "mathics/core/expression.py":1299
 *         limit = None
 *         iteration = 1
 *         names = set()             # <<<<<<<<<<<<<<
 *         definitions = evaluation.definitions
 * 
 */
  __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_names = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1300
 *         iteration = 1
 *         names = set()
 *         definitions = evaluation.definitions             # <<<<<<<<<<<<<<
 * 
 *         old_options = evaluation.options
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_definitions = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1302
 *         definitions = evaluation.definitions
 * 
 *         old_options = evaluation.options             # <<<<<<<<<<<<<<
 *         evaluation.inc_recursion_depth()
 *         try:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_old_options = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1303
 * 
 *         old_options = evaluation.options
 *         evaluation.inc_recursion_depth()             # <<<<<<<<<<<<<<
 *         try:
 *             while reevaluate:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_inc_recursion_depth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1304
 *         old_options = evaluation.options
 *         evaluation.inc_recursion_depth()
 *         try:             # <<<<<<<<<<<<<<
 *             while reevaluate:
 *                 # changed before last evaluated?
 */
  /*try:*/ {
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      /*try:*/ {

        /* "mathics/core/expression.py":1305
 *         evaluation.inc_recursion_depth()
 *         try:
 *             while reevaluate:             # <<<<<<<<<<<<<<
 *                 # changed before last evaluated?
 *                 if not expr.has_changed(definitions):
 */
        while (1) {
          __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_reevaluate); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1305, __pyx_L7_error)
          if (!__pyx_t_3) break;

          /* "mathics/core/expression.py":1307
 *             while reevaluate:
 *                 # changed before last evaluated?
 *                 if not expr.has_changed(definitions):             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_has_changed); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1307, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_definitions) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_definitions);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1307, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1307, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_8 = ((!__pyx_t_3) != 0);
          if (__pyx_t_8) {

            /* "mathics/core/expression.py":1308
 *                 # changed before last evaluated?
 *                 if not expr.has_changed(definitions):
 *                     break             # <<<<<<<<<<<<<<
 * 
 *                 names.add(expr.get_lookup_name())
 */
            goto __pyx_L14_break;

            /* "mathics/core/expression.py":1307
 *             while reevaluate:
 *                 # changed before last evaluated?
 *                 if not expr.has_changed(definitions):             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
          }

          /* "mathics/core/expression.py":1310
 *                     break
 * 
 *                 names.add(expr.get_lookup_name())             # <<<<<<<<<<<<<<
 * 
 *                 if hasattr(expr, "options") and expr.options:
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_get_lookup_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1310, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1310, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_9 = PySet_Add(__pyx_v_names, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1310, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "mathics/core/expression.py":1312
 *                 names.add(expr.get_lookup_name())
 * 
 *                 if hasattr(expr, "options") and expr.options:             # <<<<<<<<<<<<<<
 *                     evaluation.options = expr.options
 * 
 */
          __pyx_t_3 = __Pyx_HasAttr(__pyx_v_expr, __pyx_n_u_options); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1312, __pyx_L7_error)
          __pyx_t_10 = (__pyx_t_3 != 0);
          if (__pyx_t_10) {
          } else {
            __pyx_t_8 = __pyx_t_10;
            goto __pyx_L17_bool_binop_done;
          }
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1312, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1312, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_8 = __pyx_t_10;
          __pyx_L17_bool_binop_done:;
          if (__pyx_t_8) {

            /* "mathics/core/expression.py":1313
 * 
 *                 if hasattr(expr, "options") and expr.options:
 *                     evaluation.options = expr.options             # <<<<<<<<<<<<<<
 * 
 *                 expr, reevaluate = expr.evaluate_next(evaluation)
 */
            __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_2);
            if (__Pyx_PyObject_SetAttrStr(__pyx_v_evaluation, __pyx_n_s_options, __pyx_t_2) < 0) __PYX_ERR(0, 1313, __pyx_L7_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "mathics/core/expression.py":1312
 *                 names.add(expr.get_lookup_name())
 * 
 *                 if hasattr(expr, "options") and expr.options:             # <<<<<<<<<<<<<<
 *                     evaluation.options = expr.options
 * 
 */
          }

          /* "mathics/core/expression.py":1315
 *                     evaluation.options = expr.options
 * 
 *                 expr, reevaluate = expr.evaluate_next(evaluation)             # <<<<<<<<<<<<<<
 *                 if not reevaluate:
 *                     break
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_evaluate_next); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1315, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_4 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_evaluation);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1315, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
            PyObject* sequence = __pyx_t_2;
            Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
            if (unlikely(size != 2)) {
              if (size > 2) __Pyx_RaiseTooManyValuesError(2);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              __PYX_ERR(0, 1315, __pyx_L7_error)
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            if (likely(PyTuple_CheckExact(sequence))) {
              __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
              __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
            } else {
              __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
              __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
            }
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_4);
            #else
            __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1315, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1315, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else {
            Py_ssize_t index = -1;
            __pyx_t_11 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1315, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
            index = 0; __pyx_t_1 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L19_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_1);
            index = 1; __pyx_t_4 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_4)) goto __pyx_L19_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_4);
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 1315, __pyx_L7_error)
            __pyx_t_12 = NULL;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L20_unpacking_done;
            __pyx_L19_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __pyx_t_12 = NULL;
            if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
            __PYX_ERR(0, 1315, __pyx_L7_error)
            __pyx_L20_unpacking_done:;
          }
          __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_1);
          __pyx_t_1 = 0;
          __Pyx_DECREF_SET(__pyx_v_reevaluate, __pyx_t_4);
          __pyx_t_4 = 0;

          /* "mathics/core/expression.py":1316
 * 
 *                 expr, reevaluate = expr.evaluate_next(evaluation)
 *                 if not reevaluate:             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
          __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_reevaluate); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1316, __pyx_L7_error)
          __pyx_t_10 = ((!__pyx_t_8) != 0);
          if (__pyx_t_10) {

            /* "mathics/core/expression.py":1317
 *                 expr, reevaluate = expr.evaluate_next(evaluation)
 *                 if not reevaluate:
 *                     break             # <<<<<<<<<<<<<<
 * 
 *                 iteration += 1
 */
            goto __pyx_L14_break;

            /* "mathics/core/expression.py":1316
 * 
 *                 expr, reevaluate = expr.evaluate_next(evaluation)
 *                 if not reevaluate:             # <<<<<<<<<<<<<<
 *                     break
 * 
 */
          }

          /* "mathics/core/expression.py":1319
 *                     break
 * 
 *                 iteration += 1             # <<<<<<<<<<<<<<
 * 
 *                 if limit is None:
 */
          __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_iteration, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1319, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF_SET(__pyx_v_iteration, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "mathics/core/expression.py":1321
 *                 iteration += 1
 * 
 *                 if limit is None:             # <<<<<<<<<<<<<<
 *                     limit = definitions.get_config_value("$IterationLimit")
 *                     if limit is None:
 */
          __pyx_t_10 = (__pyx_v_limit == Py_None);
          __pyx_t_8 = (__pyx_t_10 != 0);
          if (__pyx_t_8) {

            /* "mathics/core/expression.py":1322
 * 
 *                 if limit is None:
 *                     limit = definitions.get_config_value("$IterationLimit")             # <<<<<<<<<<<<<<
 *                     if limit is None:
 *                         limit = "inf"
 */
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_definitions, __pyx_n_s_get_config_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1322, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_1 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_4, function);
              }
            }
            __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_kp_u_IterationLimit) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_IterationLimit);
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1322, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF_SET(__pyx_v_limit, __pyx_t_2);
            __pyx_t_2 = 0;

            /* "mathics/core/expression.py":1323
 *                 if limit is None:
 *                     limit = definitions.get_config_value("$IterationLimit")
 *                     if limit is None:             # <<<<<<<<<<<<<<
 *                         limit = "inf"
 *                 if limit != "inf" and iteration > limit:
 */
            __pyx_t_8 = (__pyx_v_limit == Py_None);
            __pyx_t_10 = (__pyx_t_8 != 0);
            if (__pyx_t_10) {

              /* "mathics/core/expression.py":1324
 *                     limit = definitions.get_config_value("$IterationLimit")
 *                     if limit is None:
 *                         limit = "inf"             # <<<<<<<<<<<<<<
 *                 if limit != "inf" and iteration > limit:
 *                     evaluation.error("$IterationLimit", "itlim", limit)
 */
              __Pyx_INCREF(__pyx_n_u_inf);
              __Pyx_DECREF_SET(__pyx_v_limit, __pyx_n_u_inf);

              /* "mathics/core/expression.py":1323
 *                 if limit is None:
 *                     limit = definitions.get_config_value("$IterationLimit")
 *                     if limit is None:             # <<<<<<<<<<<<<<
 *                         limit = "inf"
 *                 if limit != "inf" and iteration > limit:
 */
            }

            /* "mathics/core/expression.py":1321
 *                 iteration += 1
 * 
 *                 if limit is None:             # <<<<<<<<<<<<<<
 *                     limit = definitions.get_config_value("$IterationLimit")
 *                     if limit is None:
 */
          }

          /* "mathics/core/expression.py":1325
 *                     if limit is None:
 *                         limit = "inf"
 *                 if limit != "inf" and iteration > limit:             # <<<<<<<<<<<<<<
 *                     evaluation.error("$IterationLimit", "itlim", limit)
 *                     return Symbol("$Aborted")
 */
          __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_limit, __pyx_n_u_inf, Py_NE)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1325, __pyx_L7_error)
          if (__pyx_t_8) {
          } else {
            __pyx_t_10 = __pyx_t_8;
            goto __pyx_L25_bool_binop_done;
          }
          __pyx_t_2 = PyObject_RichCompare(__pyx_v_iteration, __pyx_v_limit, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1325, __pyx_L7_error)
          __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1325, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_10 = __pyx_t_8;
          __pyx_L25_bool_binop_done:;
          if (__pyx_t_10) {

            /* "mathics/core/expression.py":1326
 *                         limit = "inf"
 *                 if limit != "inf" and iteration > limit:
 *                     evaluation.error("$IterationLimit", "itlim", limit)             # <<<<<<<<<<<<<<
 *                     return Symbol("$Aborted")
 * 
 */
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1326, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_1 = NULL;
            __pyx_t_13 = 0;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_4, function);
                __pyx_t_13 = 1;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_4)) {
              PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_kp_u_IterationLimit, __pyx_n_u_itlim, __pyx_v_limit};
              __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L7_error)
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_GOTREF(__pyx_t_2);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
              PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_kp_u_IterationLimit, __pyx_n_u_itlim, __pyx_v_limit};
              __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L7_error)
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_GOTREF(__pyx_t_2);
            } else
            #endif
            {
              __pyx_t_11 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1326, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_11);
              if (__pyx_t_1) {
                __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __pyx_t_1 = NULL;
              }
              __Pyx_INCREF(__pyx_kp_u_IterationLimit);
              __Pyx_GIVEREF(__pyx_kp_u_IterationLimit);
              PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_13, __pyx_kp_u_IterationLimit);
              __Pyx_INCREF(__pyx_n_u_itlim);
              __Pyx_GIVEREF(__pyx_n_u_itlim);
              PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_13, __pyx_n_u_itlim);
              __Pyx_INCREF(__pyx_v_limit);
              __Pyx_GIVEREF(__pyx_v_limit);
              PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_13, __pyx_v_limit);
              __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L7_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "mathics/core/expression.py":1327
 *                 if limit != "inf" and iteration > limit:
 *                     evaluation.error("$IterationLimit", "itlim", limit)
 *                     return Symbol("$Aborted")             # <<<<<<<<<<<<<<
 * 
 *         # "Return gets discarded only if it was called from within the r.h.s.
 */
            __Pyx_XDECREF(__pyx_r);
            __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1327, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_11 = NULL;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
              __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_4);
              if (likely(__pyx_t_11)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
                __Pyx_INCREF(__pyx_t_11);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_4, function);
              }
            }
            __pyx_t_2 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_11, __pyx_kp_u_Aborted) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_Aborted);
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1327, __pyx_L7_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_r = __pyx_t_2;
            __pyx_t_2 = 0;
            goto __pyx_L11_try_return;

            /* "mathics/core/expression.py":1325
 *                     if limit is None:
 *                         limit = "inf"
 *                 if limit != "inf" and iteration > limit:             # <<<<<<<<<<<<<<
 *                     evaluation.error("$IterationLimit", "itlim", limit)
 *                     return Symbol("$Aborted")
 */
          }
        }
        __pyx_L14_break:;

        /* "mathics/core/expression.py":1304
 *         old_options = evaluation.options
 *         evaluation.inc_recursion_depth()
 *         try:             # <<<<<<<<<<<<<<
 *             while reevaluate:
 *                 # changed before last evaluated?
 */
      }
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L12_try_end;
      __pyx_L7_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "mathics/core/expression.py":1334
 *         # Otherwise it propogates up.
 *         #
 *         except ReturnInterrupt as ret:             # <<<<<<<<<<<<<<
 *             if names.intersection(definitions.user.keys()):
 *                 return ret.expr
 */
      __pyx_t_13 = __Pyx_PyErr_ExceptionMatches(__pyx_v_ReturnInterrupt);
      if (__pyx_t_13) {
        __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_11) < 0) __PYX_ERR(0, 1334, __pyx_L9_except_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_v_ret = __pyx_t_4;
        /*try:*/ {

          /* "mathics/core/expression.py":1335
 *         #
 *         except ReturnInterrupt as ret:
 *             if names.intersection(definitions.user.keys()):             # <<<<<<<<<<<<<<
 *                 return ret.expr
 *             else:
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_definitions, __pyx_n_s_user); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1335, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_keys); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1335, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_15, function);
            }
          }
          __pyx_t_1 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_15);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1335, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PySet_Type_intersection, __pyx_v_names, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1335, __pyx_L32_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1335, __pyx_L32_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          if (likely(__pyx_t_10)) {

            /* "mathics/core/expression.py":1336
 *         except ReturnInterrupt as ret:
 *             if names.intersection(definitions.user.keys()):
 *                 return ret.expr             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ret
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret, __pyx_n_s_expr); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1336, __pyx_L32_error)
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_r = __pyx_t_15;
            __pyx_t_15 = 0;
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L31_return;

            /* "mathics/core/expression.py":1335
 *         #
 *         except ReturnInterrupt as ret:
 *             if names.intersection(definitions.user.keys()):             # <<<<<<<<<<<<<<
 *                 return ret.expr
 *             else:
 */
          }

          /* "mathics/core/expression.py":1338
 *                 return ret.expr
 *             else:
 *                 raise ret             # <<<<<<<<<<<<<<
 *         finally:
 *             evaluation.options = old_options
 */
          /*else*/ {
            __Pyx_Raise(__pyx_v_ret, 0, 0, 0);
            __PYX_ERR(0, 1338, __pyx_L32_error)
          }
        }

        /* "mathics/core/expression.py":1334
 *         # Otherwise it propogates up.
 *         #
 *         except ReturnInterrupt as ret:             # <<<<<<<<<<<<<<
 *             if names.intersection(definitions.user.keys()):
 *                 return ret.expr
 */
        /*finally:*/ {
          __pyx_L32_error:;
          /*exception exit:*/{
            __Pyx_PyThreadState_declare
            __Pyx_PyThreadState_assign
            __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
            if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_18);
            __Pyx_XGOTREF(__pyx_t_19);
            __Pyx_XGOTREF(__pyx_t_20);
            __Pyx_XGOTREF(__pyx_t_21);
            __Pyx_XGOTREF(__pyx_t_22);
            __Pyx_XGOTREF(__pyx_t_23);
            __pyx_t_13 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename;
            {
              __Pyx_DECREF(__pyx_v_ret);
              __pyx_v_ret = NULL;
            }
            if (PY_MAJOR_VERSION >= 3) {
              __Pyx_XGIVEREF(__pyx_t_21);
              __Pyx_XGIVEREF(__pyx_t_22);
              __Pyx_XGIVEREF(__pyx_t_23);
              __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23);
            }
            __Pyx_XGIVEREF(__pyx_t_18);
            __Pyx_XGIVEREF(__pyx_t_19);
            __Pyx_XGIVEREF(__pyx_t_20);
            __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
            __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0;
            __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17;
            goto __pyx_L9_except_error;
          }
          __pyx_L31_return: {
            __pyx_t_23 = __pyx_r;
            __pyx_r = 0;
            __Pyx_DECREF(__pyx_v_ret);
            __pyx_v_ret = NULL;
            __pyx_r = __pyx_t_23;
            __pyx_t_23 = 0;
            goto __pyx_L10_except_return;
          }
        }
      }
      goto __pyx_L9_except_error;
      __pyx_L9_except_error:;

      /* "mathics/core/expression.py":1304
 *         old_options = evaluation.options
 *         evaluation.inc_recursion_depth()
 *         try:             # <<<<<<<<<<<<<<
 *             while reevaluate:
 *                 # changed before last evaluated?
 */
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L5_error;
      __pyx_L11_try_return:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L4_return;
      __pyx_L10_except_return:;
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
      goto __pyx_L4_return;
      __pyx_L12_try_end:;
    }
  }

  /* "mathics/core/expression.py":1340
 *                 raise ret
 *         finally:
 *             evaluation.options = old_options             # <<<<<<<<<<<<<<
 *             evaluation.dec_recursion_depth()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_evaluation, __pyx_n_s_options, __pyx_v_old_options) < 0) __PYX_ERR(0, 1340, __pyx_L1_error)

      /* "mathics/core/expression.py":1341
 *         finally:
 *             evaluation.options = old_options
 *             evaluation.dec_recursion_depth()             # <<<<<<<<<<<<<<
 * 
 *         return expr
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_dec_recursion_depth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_11 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L6;
    }
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_23);
      __Pyx_XGOTREF(__pyx_t_22);
      __Pyx_XGOTREF(__pyx_t_21);
      __pyx_t_16 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_24 = __pyx_filename;
      {

        /* "mathics/core/expression.py":1340
 *                 raise ret
 *         finally:
 *             evaluation.options = old_options             # <<<<<<<<<<<<<<
 *             evaluation.dec_recursion_depth()
 * 
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_evaluation, __pyx_n_s_options, __pyx_v_old_options) < 0) __PYX_ERR(0, 1340, __pyx_L40_error)

        /* "mathics/core/expression.py":1341
 *         finally:
 *             evaluation.options = old_options
 *             evaluation.dec_recursion_depth()             # <<<<<<<<<<<<<<
 * 
 *         return expr
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_dec_recursion_depth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1341, __pyx_L40_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_11 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1341, __pyx_L40_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_23);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_22, __pyx_t_21);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_6, __pyx_t_5);
      __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0;
      __pyx_lineno = __pyx_t_16; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_24;
      goto __pyx_L1_error;
      __pyx_L40_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_23);
        __Pyx_XGIVEREF(__pyx_t_22);
        __Pyx_XGIVEREF(__pyx_t_21);
        __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_22, __pyx_t_21);
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_23 = 0; __pyx_t_22 = 0; __pyx_t_21 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L4_return: {
      __pyx_t_21 = __pyx_r;
      __pyx_r = 0;

      /* "mathics/core/expression.py":1340
 *                 raise ret
 *         finally:
 *             evaluation.options = old_options             # <<<<<<<<<<<<<<
 *             evaluation.dec_recursion_depth()
 * 
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_evaluation, __pyx_n_s_options, __pyx_v_old_options) < 0) __PYX_ERR(0, 1340, __pyx_L1_error)

      /* "mathics/core/expression.py":1341
 *         finally:
 *             evaluation.options = old_options
 *             evaluation.dec_recursion_depth()             # <<<<<<<<<<<<<<
 * 
 *         return expr
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_dec_recursion_depth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_11 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_r = __pyx_t_21;
      __pyx_t_21 = 0;
      goto __pyx_L0;
    }
    __pyx_L6:;
  }

  /* "mathics/core/expression.py":1343
 *             evaluation.dec_recursion_depth()
 * 
 *         return expr             # <<<<<<<<<<<<<<
 * 
 *     def evaluate_next(self, evaluation) -> typing.Tuple["Expression", bool]:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1289
 *             return self
 * 
 *     def evaluate(self, evaluation) -> typing.Union["Expression", "Symbol"]:             # <<<<<<<<<<<<<<
 *         from mathics.core.evaluation import ReturnInterrupt
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ReturnInterrupt);
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_reevaluate);
  __Pyx_XDECREF(__pyx_v_limit);
  __Pyx_XDECREF(__pyx_v_iteration);
  __Pyx_XDECREF(__pyx_v_names);
  __Pyx_XDECREF(__pyx_v_definitions);
  __Pyx_XDECREF(__pyx_v_old_options);
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1345
 *         return expr
 * 
 *     def evaluate_next(self, evaluation) -> typing.Tuple["Expression", bool]:             # <<<<<<<<<<<<<<
 *         from mathics.builtin.base import BoxConstruct
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_77evaluate_next(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_77evaluate_next = {"evaluate_next", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_77evaluate_next, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_77evaluate_next(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_next (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_next", 1, 2, 2, 1); __PYX_ERR(0, 1345, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate_next") < 0)) __PYX_ERR(0, 1345, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate_next", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1345, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate_next", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_76evaluate_next(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

/* "mathics/core/expression.py":1352
 *         leaves = self.get_mutable_leaves()
 * 
 *         def rest_range(indices):             # <<<<<<<<<<<<<<
 *             if "System`HoldAllComplete" not in attributes:
 *                 if self._no_symbol("System`Evaluate"):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_1rest_range(PyObject *__pyx_self, PyObject *__pyx_v_indices); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_13evaluate_next_1rest_range = {"rest_range", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_1rest_range, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_1rest_range(PyObject *__pyx_self, PyObject *__pyx_v_indices) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rest_range (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_rest_range(__pyx_self, ((PyObject *)__pyx_v_indices));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_rest_range(PyObject *__pyx_self, PyObject *__pyx_v_indices) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *__pyx_cur_scope;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *__pyx_outer_scope;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rest_range", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/core/expression.py":1353
 * 
 *         def rest_range(indices):
 *             if "System`HoldAllComplete" not in attributes:             # <<<<<<<<<<<<<<
 *                 if self._no_symbol("System`Evaluate"):
 *                     return
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_attributes)) { __Pyx_RaiseClosureNameError("attributes"); __PYX_ERR(0, 1353, __pyx_L1_error) }
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_HoldAllComplete, __pyx_cur_scope->__pyx_v_attributes, Py_NE)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1353, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":1354
 *         def rest_range(indices):
 *             if "System`HoldAllComplete" not in attributes:
 *                 if self._no_symbol("System`Evaluate"):             # <<<<<<<<<<<<<<
 *                     return
 *                 for index in indices:
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1354, __pyx_L1_error) }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_no_symbol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1354, __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_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_System_Evaluate) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_System_Evaluate);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1354, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1354, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "mathics/core/expression.py":1355
 *             if "System`HoldAllComplete" not in attributes:
 *                 if self._no_symbol("System`Evaluate"):
 *                     return             # <<<<<<<<<<<<<<
 *                 for index in indices:
 *                     leaf = leaves[index]
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "mathics/core/expression.py":1354
 *         def rest_range(indices):
 *             if "System`HoldAllComplete" not in attributes:
 *                 if self._no_symbol("System`Evaluate"):             # <<<<<<<<<<<<<<
 *                     return
 *                 for index in indices:
 */
    }

    /* "mathics/core/expression.py":1356
 *                 if self._no_symbol("System`Evaluate"):
 *                     return
 *                 for index in indices:             # <<<<<<<<<<<<<<
 *                     leaf = leaves[index]
 *                     if leaf.has_form("Evaluate", 1):
 */
    if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
      __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1356, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1356, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1356, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1356, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1356, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_7(__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, 1356, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "mathics/core/expression.py":1357
 *                     return
 *                 for index in indices:
 *                     leaf = leaves[index]             # <<<<<<<<<<<<<<
 *                     if leaf.has_form("Evaluate", 1):
 *                         leaves[index] = leaf.evaluate(evaluation)
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v_leaves)) { __Pyx_RaiseClosureNameError("leaves"); __PYX_ERR(0, 1357, __pyx_L1_error) }
      __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_leaves, __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "mathics/core/expression.py":1358
 *                 for index in indices:
 *                     leaf = leaves[index]
 *                     if leaf.has_form("Evaluate", 1):             # <<<<<<<<<<<<<<
 *                         leaves[index] = leaf.evaluate(evaluation)
 * 
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_has_form); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1358, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1358, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1358, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_2) {

        /* "mathics/core/expression.py":1359
 *                     leaf = leaves[index]
 *                     if leaf.has_form("Evaluate", 1):
 *                         leaves[index] = leaf.evaluate(evaluation)             # <<<<<<<<<<<<<<
 * 
 *         def eval_range(indices):
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1359, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (unlikely(!__pyx_cur_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 1359, __pyx_L1_error) }
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1359, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_cur_scope->__pyx_v_leaves)) { __Pyx_RaiseClosureNameError("leaves"); __PYX_ERR(0, 1359, __pyx_L1_error) }
        if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_leaves, __pyx_v_index, __pyx_t_5) < 0)) __PYX_ERR(0, 1359, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "mathics/core/expression.py":1358
 *                 for index in indices:
 *                     leaf = leaves[index]
 *                     if leaf.has_form("Evaluate", 1):             # <<<<<<<<<<<<<<
 *                         leaves[index] = leaf.evaluate(evaluation)
 * 
 */
      }

      /* "mathics/core/expression.py":1356
 *                 if self._no_symbol("System`Evaluate"):
 *                     return
 *                 for index in indices:             # <<<<<<<<<<<<<<
 *                     leaf = leaves[index]
 *                     if leaf.has_form("Evaluate", 1):
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/core/expression.py":1353
 * 
 *         def rest_range(indices):
 *             if "System`HoldAllComplete" not in attributes:             # <<<<<<<<<<<<<<
 *                 if self._no_symbol("System`Evaluate"):
 *                     return
 */
  }

  /* "mathics/core/expression.py":1352
 *         leaves = self.get_mutable_leaves()
 * 
 *         def rest_range(indices):             # <<<<<<<<<<<<<<
 *             if "System`HoldAllComplete" not in attributes:
 *                 if self._no_symbol("System`Evaluate"):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate_next.rest_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1361
 *                         leaves[index] = leaf.evaluate(evaluation)
 * 
 *         def eval_range(indices):             # <<<<<<<<<<<<<<
 *             for index in indices:
 *                 leaf = leaves[index]
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_3eval_range(PyObject *__pyx_self, PyObject *__pyx_v_indices); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_13evaluate_next_3eval_range = {"eval_range", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_3eval_range, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_3eval_range(PyObject *__pyx_self, PyObject *__pyx_v_indices) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eval_range (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_2eval_range(__pyx_self, ((PyObject *)__pyx_v_indices));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_2eval_range(PyObject *__pyx_self, PyObject *__pyx_v_indices) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *__pyx_cur_scope;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *__pyx_outer_scope;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("eval_range", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/core/expression.py":1362
 * 
 *         def eval_range(indices):
 *             for index in indices:             # <<<<<<<<<<<<<<
 *                 leaf = leaves[index]
 *                 if not leaf.has_form("Unevaluated", 1):
 */
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_1 = __pyx_v_indices; __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_indices); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1362, __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, 1362, __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, 1362, __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, 1362, __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, 1362, __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, 1362, __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, 1362, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1363
 *         def eval_range(indices):
 *             for index in indices:
 *                 leaf = leaves[index]             # <<<<<<<<<<<<<<
 *                 if not leaf.has_form("Unevaluated", 1):
 *                     leaf = leaf.evaluate(evaluation)
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_leaves)) { __Pyx_RaiseClosureNameError("leaves"); __PYX_ERR(0, 1363, __pyx_L1_error) }
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_leaves, __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1364
 *             for index in indices:
 *                 leaf = leaves[index]
 *                 if not leaf.has_form("Unevaluated", 1):             # <<<<<<<<<<<<<<
 *                     leaf = leaf.evaluate(evaluation)
 *                     if leaf:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_has_form); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1364, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = ((!__pyx_t_6) != 0);
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":1365
 *                 leaf = leaves[index]
 *                 if not leaf.has_form("Unevaluated", 1):
 *                     leaf = leaf.evaluate(evaluation)             # <<<<<<<<<<<<<<
 *                     if leaf:
 *                         leaves[index] = leaf
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1365, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(!__pyx_cur_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 1365, __pyx_L1_error) }
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_evaluation);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1365, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_leaf, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "mathics/core/expression.py":1366
 *                 if not leaf.has_form("Unevaluated", 1):
 *                     leaf = leaf.evaluate(evaluation)
 *                     if leaf:             # <<<<<<<<<<<<<<
 *                         leaves[index] = leaf
 * 
 */
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_leaf); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1366, __pyx_L1_error)
      if (__pyx_t_7) {

        /* "mathics/core/expression.py":1367
 *                     leaf = leaf.evaluate(evaluation)
 *                     if leaf:
 *                         leaves[index] = leaf             # <<<<<<<<<<<<<<
 * 
 *         if "System`HoldAll" in attributes or "System`HoldAllComplete" in attributes:
 */
        if (unlikely(!__pyx_cur_scope->__pyx_v_leaves)) { __Pyx_RaiseClosureNameError("leaves"); __PYX_ERR(0, 1367, __pyx_L1_error) }
        if (unlikely(PyObject_SetItem(__pyx_cur_scope->__pyx_v_leaves, __pyx_v_index, __pyx_v_leaf) < 0)) __PYX_ERR(0, 1367, __pyx_L1_error)

        /* "mathics/core/expression.py":1366
 *                 if not leaf.has_form("Unevaluated", 1):
 *                     leaf = leaf.evaluate(evaluation)
 *                     if leaf:             # <<<<<<<<<<<<<<
 *                         leaves[index] = leaf
 * 
 */
      }

      /* "mathics/core/expression.py":1364
 *             for index in indices:
 *                 leaf = leaves[index]
 *                 if not leaf.has_form("Unevaluated", 1):             # <<<<<<<<<<<<<<
 *                     leaf = leaf.evaluate(evaluation)
 *                     if leaf:
 */
    }

    /* "mathics/core/expression.py":1362
 * 
 *         def eval_range(indices):
 *             for index in indices:             # <<<<<<<<<<<<<<
 *                 leaf = leaves[index]
 *                 if not leaf.has_form("Unevaluated", 1):
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1361
 *                         leaves[index] = leaf.evaluate(evaluation)
 * 
 *         def eval_range(indices):             # <<<<<<<<<<<<<<
 *             for index in indices:
 *                 leaf = leaves[index]
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate_next.eval_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1410
 *                 leaves = dirty_leaves
 * 
 *         def flatten_callback(new_leaves, old):             # <<<<<<<<<<<<<<
 *             for leaf in new_leaves:
 *                 leaf.unevaluated = old.unevaluated
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_5flatten_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_13evaluate_next_5flatten_callback = {"flatten_callback", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_5flatten_callback, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_5flatten_callback(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_new_leaves = 0;
  PyObject *__pyx_v_old = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("flatten_callback (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_new_leaves,&__pyx_n_s_old,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_new_leaves)) != 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_old)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("flatten_callback", 1, 2, 2, 1); __PYX_ERR(0, 1410, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flatten_callback") < 0)) __PYX_ERR(0, 1410, __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_new_leaves = values[0];
    __pyx_v_old = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("flatten_callback", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1410, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate_next.flatten_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_4flatten_callback(__pyx_self, __pyx_v_new_leaves, __pyx_v_old);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_4flatten_callback(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_new_leaves, PyObject *__pyx_v_old) {
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("flatten_callback", 0);

  /* "mathics/core/expression.py":1411
 * 
 *         def flatten_callback(new_leaves, old):
 *             for leaf in new_leaves:             # <<<<<<<<<<<<<<
 *                 leaf.unevaluated = old.unevaluated
 * 
 */
  if (likely(PyList_CheckExact(__pyx_v_new_leaves)) || PyTuple_CheckExact(__pyx_v_new_leaves)) {
    __pyx_t_1 = __pyx_v_new_leaves; __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_new_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1411, __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, 1411, __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, 1411, __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, 1411, __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, 1411, __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, 1411, __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, 1411, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1412
 *         def flatten_callback(new_leaves, old):
 *             for leaf in new_leaves:
 *                 leaf.unevaluated = old.unevaluated             # <<<<<<<<<<<<<<
 * 
 *         if "System`Flat" in attributes:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_old, __pyx_n_s_unevaluated); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_leaf, __pyx_n_s_unevaluated, __pyx_t_4) < 0) __PYX_ERR(0, 1412, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1411
 * 
 *         def flatten_callback(new_leaves, old):
 *             for leaf in new_leaves:             # <<<<<<<<<<<<<<
 *                 leaf.unevaluated = old.unevaluated
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1410
 *                 leaves = dirty_leaves
 * 
 *         def flatten_callback(new_leaves, old):             # <<<<<<<<<<<<<<
 *             for leaf in new_leaves:
 *                 leaf.unevaluated = old.unevaluated
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate_next.flatten_callback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_4core_10expression_10Expression_13evaluate_next_8generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/core/expression.py":1430
 *                     return threaded, True
 * 
 *         def rules():             # <<<<<<<<<<<<<<
 *             rules_names = set()
 *             if "System`HoldAllComplete" not in attributes:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_7rules(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_13evaluate_next_7rules = {"rules", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_7rules, METH_NOARGS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_13evaluate_next_7rules(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rules (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_6rules(__pyx_self);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_6rules(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rules", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_19_rules(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_19_rules, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1430, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *) __Pyx_CyFunction_GetClosure(__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_7mathics_4core_10expression_10Expression_13evaluate_next_8generator9, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_rules, __pyx_n_s_Expression_evaluate_next_locals, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 1430, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate_next.rules", __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_7mathics_4core_10expression_10Expression_13evaluate_next_8generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rules", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L11_resume_from_yield;
    case 2: goto __pyx_L15_resume_from_yield;
    case 3: goto __pyx_L18_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, 1430, __pyx_L1_error)

  /* "mathics/core/expression.py":1431
 * 
 *         def rules():
 *             rules_names = set()             # <<<<<<<<<<<<<<
 *             if "System`HoldAllComplete" not in attributes:
 *                 for leaf in leaves:
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_rules_names = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1432
 *         def rules():
 *             rules_names = set()
 *             if "System`HoldAllComplete" not in attributes:             # <<<<<<<<<<<<<<
 *                 for leaf in leaves:
 *                     name = leaf.get_lookup_name()
 */
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_attributes)) { __Pyx_RaiseClosureNameError("attributes"); __PYX_ERR(0, 1432, __pyx_L1_error) }
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_HoldAllComplete, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_attributes, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1432, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":1433
 *             rules_names = set()
 *             if "System`HoldAllComplete" not in attributes:
 *                 for leaf in leaves:             # <<<<<<<<<<<<<<
 *                     name = leaf.get_lookup_name()
 *                     if len(name) > 0:  # only lookup rules if this is a symbol
 */
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_leaves)) { __Pyx_RaiseClosureNameError("leaves"); __PYX_ERR(0, 1433, __pyx_L1_error) }
    if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_leaves)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_leaves)) {
      __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_leaves; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1433, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1433, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1433, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1433, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1433, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_1);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1433, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_leaf);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_leaf, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;

      /* "mathics/core/expression.py":1434
 *             if "System`HoldAllComplete" not in attributes:
 *                 for leaf in leaves:
 *                     name = leaf.get_lookup_name()             # <<<<<<<<<<<<<<
 *                     if len(name) > 0:  # only lookup rules if this is a symbol
 *                         if name not in rules_names:
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_leaf, __pyx_n_s_get_lookup_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;

      /* "mathics/core/expression.py":1435
 *                 for leaf in leaves:
 *                     name = leaf.get_lookup_name()
 *                     if len(name) > 0:  # only lookup rules if this is a symbol             # <<<<<<<<<<<<<<
 *                         if name not in rules_names:
 *                             rules_names.add(name)
 */
      __pyx_t_9 = PyObject_Length(__pyx_cur_scope->__pyx_v_name); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1435, __pyx_L1_error)
      __pyx_t_3 = ((__pyx_t_9 > 0) != 0);
      if (__pyx_t_3) {

        /* "mathics/core/expression.py":1436
 *                     name = leaf.get_lookup_name()
 *                     if len(name) > 0:  # only lookup rules if this is a symbol
 *                         if name not in rules_names:             # <<<<<<<<<<<<<<
 *                             rules_names.add(name)
 *                             for rule in evaluation.definitions.get_upvalues(name):
 */
        __pyx_t_3 = (__Pyx_PySet_ContainsTF(__pyx_cur_scope->__pyx_v_name, __pyx_cur_scope->__pyx_v_rules_names, Py_NE)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1436, __pyx_L1_error)
        __pyx_t_2 = (__pyx_t_3 != 0);
        if (__pyx_t_2) {

          /* "mathics/core/expression.py":1437
 *                     if len(name) > 0:  # only lookup rules if this is a symbol
 *                         if name not in rules_names:
 *                             rules_names.add(name)             # <<<<<<<<<<<<<<
 *                             for rule in evaluation.definitions.get_upvalues(name):
 *                                 yield rule
 */
          __pyx_t_10 = PySet_Add(__pyx_cur_scope->__pyx_v_rules_names, __pyx_cur_scope->__pyx_v_name); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1437, __pyx_L1_error)

          /* "mathics/core/expression.py":1438
 *                         if name not in rules_names:
 *                             rules_names.add(name)
 *                             for rule in evaluation.definitions.get_upvalues(name):             # <<<<<<<<<<<<<<
 *                                 yield rule
 *             lookup_name = new.get_lookup_name()
 */
          if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 1438, __pyx_L1_error) }
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1438, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_get_upvalues); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1438, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_8, function);
            }
          }
          __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_cur_scope->__pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_cur_scope->__pyx_v_name);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1438, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
            __pyx_t_8 = __pyx_t_6; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0;
            __pyx_t_11 = NULL;
          } else {
            __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1438, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_11 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1438, __pyx_L1_error)
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          for (;;) {
            if (likely(!__pyx_t_11)) {
              if (likely(PyList_CheckExact(__pyx_t_8))) {
                if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_6 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1438, __pyx_L1_error)
                #else
                __pyx_t_6 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1438, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_6);
                #endif
              } else {
                if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1438, __pyx_L1_error)
                #else
                __pyx_t_6 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1438, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_6);
                #endif
              }
            } else {
              __pyx_t_6 = __pyx_t_11(__pyx_t_8);
              if (unlikely(!__pyx_t_6)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                  else __PYX_ERR(0, 1438, __pyx_L1_error)
                }
                break;
              }
              __Pyx_GOTREF(__pyx_t_6);
            }
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rule);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_rule, __pyx_t_6);
            __Pyx_GIVEREF(__pyx_t_6);
            __pyx_t_6 = 0;

            /* "mathics/core/expression.py":1439
 *                             rules_names.add(name)
 *                             for rule in evaluation.definitions.get_upvalues(name):
 *                                 yield rule             # <<<<<<<<<<<<<<
 *             lookup_name = new.get_lookup_name()
 *             if lookup_name == new.get_head_name():
 */
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rule);
            __pyx_r = __pyx_cur_scope->__pyx_v_rule;
            __Pyx_XGIVEREF(__pyx_t_1);
            __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
            __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
            __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
            __Pyx_XGIVEREF(__pyx_t_8);
            __pyx_cur_scope->__pyx_t_3 = __pyx_t_8;
            __pyx_cur_scope->__pyx_t_4 = __pyx_t_9;
            __pyx_cur_scope->__pyx_t_5 = __pyx_t_11;
            __Pyx_XGIVEREF(__pyx_r);
            __Pyx_RefNannyFinishContext();
            __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
            /* return from generator, yielding value */
            __pyx_generator->resume_label = 1;
            return __pyx_r;
            __pyx_L11_resume_from_yield:;
            __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
            __pyx_cur_scope->__pyx_t_0 = 0;
            __Pyx_XGOTREF(__pyx_t_1);
            __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
            __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
            __pyx_t_8 = __pyx_cur_scope->__pyx_t_3;
            __pyx_cur_scope->__pyx_t_3 = 0;
            __Pyx_XGOTREF(__pyx_t_8);
            __pyx_t_9 = __pyx_cur_scope->__pyx_t_4;
            __pyx_t_11 = __pyx_cur_scope->__pyx_t_5;
            if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1439, __pyx_L1_error)

            /* "mathics/core/expression.py":1438
 *                         if name not in rules_names:
 *                             rules_names.add(name)
 *                             for rule in evaluation.definitions.get_upvalues(name):             # <<<<<<<<<<<<<<
 *                                 yield rule
 *             lookup_name = new.get_lookup_name()
 */
          }
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "mathics/core/expression.py":1436
 *                     name = leaf.get_lookup_name()
 *                     if len(name) > 0:  # only lookup rules if this is a symbol
 *                         if name not in rules_names:             # <<<<<<<<<<<<<<
 *                             rules_names.add(name)
 *                             for rule in evaluation.definitions.get_upvalues(name):
 */
        }

        /* "mathics/core/expression.py":1435
 *                 for leaf in leaves:
 *                     name = leaf.get_lookup_name()
 *                     if len(name) > 0:  # only lookup rules if this is a symbol             # <<<<<<<<<<<<<<
 *                         if name not in rules_names:
 *                             rules_names.add(name)
 */
      }

      /* "mathics/core/expression.py":1433
 *             rules_names = set()
 *             if "System`HoldAllComplete" not in attributes:
 *                 for leaf in leaves:             # <<<<<<<<<<<<<<
 *                     name = leaf.get_lookup_name()
 *                     if len(name) > 0:  # only lookup rules if this is a symbol
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1432
 *         def rules():
 *             rules_names = set()
 *             if "System`HoldAllComplete" not in attributes:             # <<<<<<<<<<<<<<
 *                 for leaf in leaves:
 *                     name = leaf.get_lookup_name()
 */
  }

  /* "mathics/core/expression.py":1440
 *                             for rule in evaluation.definitions.get_upvalues(name):
 *                                 yield rule
 *             lookup_name = new.get_lookup_name()             # <<<<<<<<<<<<<<
 *             if lookup_name == new.get_head_name():
 *                 for rule in evaluation.definitions.get_downvalues(lookup_name):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_new)) { __Pyx_RaiseClosureNameError("new"); __PYX_ERR(0, 1440, __pyx_L1_error) }
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_new, __pyx_n_s_get_lookup_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_lookup_name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1441
 *                                 yield rule
 *             lookup_name = new.get_lookup_name()
 *             if lookup_name == new.get_head_name():             # <<<<<<<<<<<<<<
 *                 for rule in evaluation.definitions.get_downvalues(lookup_name):
 *                     yield rule
 */
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_new)) { __Pyx_RaiseClosureNameError("new"); __PYX_ERR(0, 1441, __pyx_L1_error) }
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_new, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_lookup_name, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1441, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":1442
 *             lookup_name = new.get_lookup_name()
 *             if lookup_name == new.get_head_name():
 *                 for rule in evaluation.definitions.get_downvalues(lookup_name):             # <<<<<<<<<<<<<<
 *                     yield rule
 *             else:
 */
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 1442, __pyx_L1_error) }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get_downvalues); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_8 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_cur_scope->__pyx_v_lookup_name) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_cur_scope->__pyx_v_lookup_name);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
      __pyx_t_6 = __pyx_t_8; __Pyx_INCREF(__pyx_t_6); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1442, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1442, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1442, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1442, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_8); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1442, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1442, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_5(__pyx_t_6);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1442, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rule);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_rule, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_8 = 0;

      /* "mathics/core/expression.py":1443
 *             if lookup_name == new.get_head_name():
 *                 for rule in evaluation.definitions.get_downvalues(lookup_name):
 *                     yield rule             # <<<<<<<<<<<<<<
 *             else:
 *                 for rule in evaluation.definitions.get_subvalues(lookup_name):
 */
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rule);
      __pyx_r = __pyx_cur_scope->__pyx_v_rule;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
      __Pyx_XGIVEREF(__pyx_t_6);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_6;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 2;
      return __pyx_r;
      __pyx_L15_resume_from_yield:;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
      __pyx_t_6 = __pyx_cur_scope->__pyx_t_0;
      __pyx_cur_scope->__pyx_t_0 = 0;
      __Pyx_XGOTREF(__pyx_t_6);
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1443, __pyx_L1_error)

      /* "mathics/core/expression.py":1442
 *             lookup_name = new.get_lookup_name()
 *             if lookup_name == new.get_head_name():
 *                 for rule in evaluation.definitions.get_downvalues(lookup_name):             # <<<<<<<<<<<<<<
 *                     yield rule
 *             else:
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "mathics/core/expression.py":1441
 *                                 yield rule
 *             lookup_name = new.get_lookup_name()
 *             if lookup_name == new.get_head_name():             # <<<<<<<<<<<<<<
 *                 for rule in evaluation.definitions.get_downvalues(lookup_name):
 *                     yield rule
 */
    goto __pyx_L12;
  }

  /* "mathics/core/expression.py":1445
 *                     yield rule
 *             else:
 *                 for rule in evaluation.definitions.get_subvalues(lookup_name):             # <<<<<<<<<<<<<<
 *                     yield rule
 * 
 */
  /*else*/ {
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 1445, __pyx_L1_error) }
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_get_subvalues); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_cur_scope->__pyx_v_lookup_name) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_cur_scope->__pyx_v_lookup_name);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1445, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
      __pyx_t_1 = __pyx_t_6; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1445, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1445, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1445, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1445, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1445, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_5(__pyx_t_1);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1445, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_rule);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_rule, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;

      /* "mathics/core/expression.py":1446
 *             else:
 *                 for rule in evaluation.definitions.get_subvalues(lookup_name):
 *                     yield rule             # <<<<<<<<<<<<<<
 * 
 *         for rule in rules():
 */
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rule);
      __pyx_r = __pyx_cur_scope->__pyx_v_rule;
      __Pyx_XGIVEREF(__pyx_t_1);
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
      /* return from generator, yielding value */
      __pyx_generator->resume_label = 3;
      return __pyx_r;
      __pyx_L18_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_4 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1446, __pyx_L1_error)

      /* "mathics/core/expression.py":1445
 *                     yield rule
 *             else:
 *                 for rule in evaluation.definitions.get_subvalues(lookup_name):             # <<<<<<<<<<<<<<
 *                     yield rule
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L12:;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "mathics/core/expression.py":1430
 *                     return threaded, True
 * 
 *         def rules():             # <<<<<<<<<<<<<<
 *             rules_names = set()
 *             if "System`HoldAllComplete" not in attributes:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("rules", __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;
}

/* "mathics/core/expression.py":1345
 *         return expr
 * 
 *     def evaluate_next(self, evaluation) -> typing.Tuple["Expression", bool]:             # <<<<<<<<<<<<<<
 *         from mathics.builtin.base import BoxConstruct
 * 
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_76evaluate_next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *__pyx_cur_scope;
  PyObject *__pyx_v_BoxConstruct = NULL;
  PyObject *__pyx_v_head = NULL;
  PyObject *__pyx_v_rest_range = 0;
  PyObject *__pyx_v_eval_range = 0;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_v_dirty_leaves = NULL;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_flatten_callback = 0;
  PyObject *__pyx_v_done = NULL;
  PyObject *__pyx_v_threaded = NULL;
  PyObject *__pyx_v_rules = 0;
  PyObject *__pyx_v_rule = NULL;
  PyObject *__pyx_v_result = 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;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  long __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate_next", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1345, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_evaluation = __pyx_v_evaluation;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);

  /* "mathics/core/expression.py":1346
 * 
 *     def evaluate_next(self, evaluation) -> typing.Tuple["Expression", bool]:
 *         from mathics.builtin.base import BoxConstruct             # <<<<<<<<<<<<<<
 * 
 *         head = self._head.evaluate(evaluation)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_BoxConstruct);
  __Pyx_GIVEREF(__pyx_n_s_BoxConstruct);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_BoxConstruct);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_builtin_base, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1346, __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_BoxConstruct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_BoxConstruct = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1348
 *         from mathics.builtin.base import BoxConstruct
 * 
 *         head = self._head.evaluate(evaluation)             # <<<<<<<<<<<<<<
 *         attributes = head.get_attributes(evaluation.definitions)
 *         leaves = self.get_mutable_leaves()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_head = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1349
 * 
 *         head = self._head.evaluate(evaluation)
 *         attributes = head.get_attributes(evaluation.definitions)             # <<<<<<<<<<<<<<
 *         leaves = self.get_mutable_leaves()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_head, __pyx_n_s_get_attributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_attributes = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1350
 *         head = self._head.evaluate(evaluation)
 *         attributes = head.get_attributes(evaluation.definitions)
 *         leaves = self.get_mutable_leaves()             # <<<<<<<<<<<<<<
 * 
 *         def rest_range(indices):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_get_mutable_leaves); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_leaves = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1352
 *         leaves = self.get_mutable_leaves()
 * 
 *         def rest_range(indices):             # <<<<<<<<<<<<<<
 *             if "System`HoldAllComplete" not in attributes:
 *                 if self._no_symbol("System`Evaluate"):
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_13evaluate_next_1rest_range, 0, __pyx_n_s_Expression_evaluate_next_locals_2, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_rest_range = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1361
 *                         leaves[index] = leaf.evaluate(evaluation)
 * 
 *         def eval_range(indices):             # <<<<<<<<<<<<<<
 *             for index in indices:
 *                 leaf = leaves[index]
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_13evaluate_next_3eval_range, 0, __pyx_n_s_Expression_evaluate_next_locals_3, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_eval_range = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1369
 *                         leaves[index] = leaf
 * 
 *         if "System`HoldAll" in attributes or "System`HoldAllComplete" in attributes:             # <<<<<<<<<<<<<<
 *             # eval_range(range(0, 0))
 *             rest_range(range(len(leaves)))
 */
  __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_HoldAll, __pyx_cur_scope->__pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1369, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_5 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_HoldAllComplete, __pyx_cur_scope->__pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1369, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_7 != 0);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":1371
 *         if "System`HoldAll" in attributes or "System`HoldAllComplete" in attributes:
 *             # eval_range(range(0, 0))
 *             rest_range(range(len(leaves)))             # <<<<<<<<<<<<<<
 *         elif "System`HoldFirst" in attributes:
 *             rest_range(range(0, min(1, len(leaves))))
 */
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_leaves;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1371, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_rest_range(__pyx_v_rest_range, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1371, __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;

    /* "mathics/core/expression.py":1369
 *                         leaves[index] = leaf
 * 
 *         if "System`HoldAll" in attributes or "System`HoldAllComplete" in attributes:             # <<<<<<<<<<<<<<
 *             # eval_range(range(0, 0))
 *             rest_range(range(len(leaves)))
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":1372
 *             # eval_range(range(0, 0))
 *             rest_range(range(len(leaves)))
 *         elif "System`HoldFirst" in attributes:             # <<<<<<<<<<<<<<
 *             rest_range(range(0, min(1, len(leaves))))
 *             eval_range(range(1, len(leaves)))
 */
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_HoldFirst, __pyx_cur_scope->__pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1372, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1373
 *             rest_range(range(len(leaves)))
 *         elif "System`HoldFirst" in attributes:
 *             rest_range(range(0, min(1, len(leaves))))             # <<<<<<<<<<<<<<
 *             eval_range(range(1, len(leaves)))
 *         elif "System`HoldRest" in attributes:
 */
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_leaves;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1373, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = 1;
    if (((__pyx_t_8 < __pyx_t_9) != 0)) {
      __pyx_t_10 = __pyx_t_8;
    } else {
      __pyx_t_10 = __pyx_t_9;
    }
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_rest_range(__pyx_v_rest_range, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/core/expression.py":1374
 *         elif "System`HoldFirst" in attributes:
 *             rest_range(range(0, min(1, len(leaves))))
 *             eval_range(range(1, len(leaves)))             # <<<<<<<<<<<<<<
 *         elif "System`HoldRest" in attributes:
 *             eval_range(range(0, min(1, len(leaves))))
 */
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_leaves;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_10 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1374, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_2eval_range(__pyx_v_eval_range, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1374, __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;

    /* "mathics/core/expression.py":1372
 *             # eval_range(range(0, 0))
 *             rest_range(range(len(leaves)))
 *         elif "System`HoldFirst" in attributes:             # <<<<<<<<<<<<<<
 *             rest_range(range(0, min(1, len(leaves))))
 *             eval_range(range(1, len(leaves)))
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":1375
 *             rest_range(range(0, min(1, len(leaves))))
 *             eval_range(range(1, len(leaves)))
 *         elif "System`HoldRest" in attributes:             # <<<<<<<<<<<<<<
 *             eval_range(range(0, min(1, len(leaves))))
 *             rest_range(range(1, len(leaves)))
 */
  __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_HoldRest, __pyx_cur_scope->__pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1375, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_6 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":1376
 *             eval_range(range(1, len(leaves)))
 *         elif "System`HoldRest" in attributes:
 *             eval_range(range(0, min(1, len(leaves))))             # <<<<<<<<<<<<<<
 *             rest_range(range(1, len(leaves)))
 *         else:
 */
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_leaves;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = 1;
    if (((__pyx_t_10 < __pyx_t_9) != 0)) {
      __pyx_t_8 = __pyx_t_10;
    } else {
      __pyx_t_8 = __pyx_t_9;
    }
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_2eval_range(__pyx_v_eval_range, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/core/expression.py":1377
 *         elif "System`HoldRest" in attributes:
 *             eval_range(range(0, min(1, len(leaves))))
 *             rest_range(range(1, len(leaves)))             # <<<<<<<<<<<<<<
 *         else:
 *             eval_range(range(len(leaves)))
 */
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_leaves;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_8 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1377, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1377, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1377, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1377, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_rest_range(__pyx_v_rest_range, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1377, __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;

    /* "mathics/core/expression.py":1375
 *             rest_range(range(0, min(1, len(leaves))))
 *             eval_range(range(1, len(leaves)))
 *         elif "System`HoldRest" in attributes:             # <<<<<<<<<<<<<<
 *             eval_range(range(0, min(1, len(leaves))))
 *             rest_range(range(1, len(leaves)))
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":1379
 *             rest_range(range(1, len(leaves)))
 *         else:
 *             eval_range(range(len(leaves)))             # <<<<<<<<<<<<<<
 *             # rest_range(range(0, 0))
 * 
 */
  /*else*/ {
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_leaves;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1379, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_2eval_range(__pyx_v_eval_range, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1379, __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_L3:;

  /* "mathics/core/expression.py":1382
 *             # rest_range(range(0, 0))
 * 
 *         new = Expression(head)             # <<<<<<<<<<<<<<
 *         new._leaves = tuple(leaves)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_head);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_new = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1383
 * 
 *         new = Expression(head)
 *         new._leaves = tuple(leaves)             # <<<<<<<<<<<<<<
 * 
 *         if (
 */
  __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_cur_scope->__pyx_v_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_leaves_2, __pyx_t_2) < 0) __PYX_ERR(0, 1383, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1386
 * 
 *         if (
 *             "System`SequenceHold" not in attributes             # <<<<<<<<<<<<<<
 *             and "System`HoldAllComplete" not in attributes  # noqa
 *         ):
 */
  __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_SequenceHold, __pyx_cur_scope->__pyx_v_attributes, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1386, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_5 = __pyx_t_7;
    goto __pyx_L7_bool_binop_done;
  }

  /* "mathics/core/expression.py":1387
 *         if (
 *             "System`SequenceHold" not in attributes
 *             and "System`HoldAllComplete" not in attributes  # noqa             # <<<<<<<<<<<<<<
 *         ):
 *             new = new.flatten_sequence(evaluation)
 */
  __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_HoldAllComplete, __pyx_cur_scope->__pyx_v_attributes, Py_NE)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1387, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_7 != 0);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L7_bool_binop_done:;

  /* "mathics/core/expression.py":1385
 *         new._leaves = tuple(leaves)
 * 
 *         if (             # <<<<<<<<<<<<<<
 *             "System`SequenceHold" not in attributes
 *             and "System`HoldAllComplete" not in attributes  # noqa
 */
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":1389
 *             and "System`HoldAllComplete" not in attributes  # noqa
 *         ):
 *             new = new.flatten_sequence(evaluation)             # <<<<<<<<<<<<<<
 *             leaves = new._leaves
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_flatten_sequence_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_evaluation);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_new, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1390
 *         ):
 *             new = new.flatten_sequence(evaluation)
 *             leaves = new._leaves             # <<<<<<<<<<<<<<
 * 
 *         for leaf in leaves:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1390, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_leaves);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_leaves, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1385
 *         new._leaves = tuple(leaves)
 * 
 *         if (             # <<<<<<<<<<<<<<
 *             "System`SequenceHold" not in attributes
 *             and "System`HoldAllComplete" not in attributes  # noqa
 */
  }

  /* "mathics/core/expression.py":1392
 *             leaves = new._leaves
 * 
 *         for leaf in leaves:             # <<<<<<<<<<<<<<
 *             leaf.unevaluated = False
 * 
 */
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_leaves)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_leaves)) {
    __pyx_t_2 = __pyx_cur_scope->__pyx_v_leaves; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1392, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1392, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1392, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1392, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1392, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_11(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1392, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":1393
 * 
 *         for leaf in leaves:
 *             leaf.unevaluated = False             # <<<<<<<<<<<<<<
 * 
 *         if "System`HoldAllComplete" not in attributes:
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_leaf, __pyx_n_s_unevaluated, Py_False) < 0) __PYX_ERR(0, 1393, __pyx_L1_error)

    /* "mathics/core/expression.py":1392
 *             leaves = new._leaves
 * 
 *         for leaf in leaves:             # <<<<<<<<<<<<<<
 *             leaf.unevaluated = False
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1395
 *             leaf.unevaluated = False
 * 
 *         if "System`HoldAllComplete" not in attributes:             # <<<<<<<<<<<<<<
 *             dirty_leaves = None
 * 
 */
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_HoldAllComplete, __pyx_cur_scope->__pyx_v_attributes, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1395, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1396
 * 
 *         if "System`HoldAllComplete" not in attributes:
 *             dirty_leaves = None             # <<<<<<<<<<<<<<
 * 
 *             for index, leaf in enumerate(leaves):
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_dirty_leaves = ((PyObject*)Py_None);

    /* "mathics/core/expression.py":1398
 *             dirty_leaves = None
 * 
 *             for index, leaf in enumerate(leaves):             # <<<<<<<<<<<<<<
 *                 if leaf.has_form("Unevaluated", 1):
 *                     if dirty_leaves is None:
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_2 = __pyx_int_0;
    if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_leaves)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_leaves)) {
      __pyx_t_3 = __pyx_cur_scope->__pyx_v_leaves; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_leaves); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1398, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_11)) {
        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_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1398, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1398, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1398, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1398, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_11(__pyx_t_3);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1398, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_2);
      __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2);
      __pyx_t_2 = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "mathics/core/expression.py":1399
 * 
 *             for index, leaf in enumerate(leaves):
 *                 if leaf.has_form("Unevaluated", 1):             # <<<<<<<<<<<<<<
 *                     if dirty_leaves is None:
 *                         dirty_leaves = list(leaves)
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_has_form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1399, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":1400
 *             for index, leaf in enumerate(leaves):
 *                 if leaf.has_form("Unevaluated", 1):
 *                     if dirty_leaves is None:             # <<<<<<<<<<<<<<
 *                         dirty_leaves = list(leaves)
 *                     dirty_leaves[index] = leaf._leaves[0]
 */
        __pyx_t_6 = (__pyx_v_dirty_leaves == ((PyObject*)Py_None));
        __pyx_t_5 = (__pyx_t_6 != 0);
        if (__pyx_t_5) {

          /* "mathics/core/expression.py":1401
 *                 if leaf.has_form("Unevaluated", 1):
 *                     if dirty_leaves is None:
 *                         dirty_leaves = list(leaves)             # <<<<<<<<<<<<<<
 *                     dirty_leaves[index] = leaf._leaves[0]
 *                     dirty_leaves[index].unevaluated = True
 */
          __pyx_t_4 = PySequence_List(__pyx_cur_scope->__pyx_v_leaves); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1401, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF_SET(__pyx_v_dirty_leaves, ((PyObject*)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "mathics/core/expression.py":1400
 *             for index, leaf in enumerate(leaves):
 *                 if leaf.has_form("Unevaluated", 1):
 *                     if dirty_leaves is None:             # <<<<<<<<<<<<<<
 *                         dirty_leaves = list(leaves)
 *                     dirty_leaves[index] = leaf._leaves[0]
 */
        }

        /* "mathics/core/expression.py":1402
 *                     if dirty_leaves is None:
 *                         dirty_leaves = list(leaves)
 *                     dirty_leaves[index] = leaf._leaves[0]             # <<<<<<<<<<<<<<
 *                     dirty_leaves[index].unevaluated = True
 * 
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1402, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1402, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(__pyx_v_dirty_leaves == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 1402, __pyx_L1_error)
        }
        if (unlikely(PyObject_SetItem(__pyx_v_dirty_leaves, __pyx_v_index, __pyx_t_1) < 0)) __PYX_ERR(0, 1402, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "mathics/core/expression.py":1403
 *                         dirty_leaves = list(leaves)
 *                     dirty_leaves[index] = leaf._leaves[0]
 *                     dirty_leaves[index].unevaluated = True             # <<<<<<<<<<<<<<
 * 
 *             if dirty_leaves:
 */
        if (unlikely(__pyx_v_dirty_leaves == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(0, 1403, __pyx_L1_error)
        }
        __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_dirty_leaves, __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1403, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__Pyx_PyObject_SetAttrStr(__pyx_t_1, __pyx_n_s_unevaluated, Py_True) < 0) __PYX_ERR(0, 1403, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "mathics/core/expression.py":1399
 * 
 *             for index, leaf in enumerate(leaves):
 *                 if leaf.has_form("Unevaluated", 1):             # <<<<<<<<<<<<<<
 *                     if dirty_leaves is None:
 *                         dirty_leaves = list(leaves)
 */
      }

      /* "mathics/core/expression.py":1398
 *             dirty_leaves = None
 * 
 *             for index, leaf in enumerate(leaves):             # <<<<<<<<<<<<<<
 *                 if leaf.has_form("Unevaluated", 1):
 *                     if dirty_leaves is None:
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1405
 *                     dirty_leaves[index].unevaluated = True
 * 
 *             if dirty_leaves:             # <<<<<<<<<<<<<<
 *                 new = Expression(head)
 *                 new._leaves = tuple(dirty_leaves)
 */
    __pyx_t_5 = (__pyx_v_dirty_leaves != Py_None)&&(PyList_GET_SIZE(__pyx_v_dirty_leaves) != 0);
    if (__pyx_t_5) {

      /* "mathics/core/expression.py":1406
 * 
 *             if dirty_leaves:
 *                 new = Expression(head)             # <<<<<<<<<<<<<<
 *                 new._leaves = tuple(dirty_leaves)
 *                 leaves = dirty_leaves
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1406, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_head);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1406, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new);
      __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_new, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1407
 *             if dirty_leaves:
 *                 new = Expression(head)
 *                 new._leaves = tuple(dirty_leaves)             # <<<<<<<<<<<<<<
 *                 leaves = dirty_leaves
 * 
 */
      if (unlikely(__pyx_v_dirty_leaves == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
        __PYX_ERR(0, 1407, __pyx_L1_error)
      }
      __pyx_t_2 = PyList_AsTuple(__pyx_v_dirty_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_leaves_2, __pyx_t_2) < 0) __PYX_ERR(0, 1407, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1408
 *                 new = Expression(head)
 *                 new._leaves = tuple(dirty_leaves)
 *                 leaves = dirty_leaves             # <<<<<<<<<<<<<<
 * 
 *         def flatten_callback(new_leaves, old):
 */
      __Pyx_INCREF(__pyx_v_dirty_leaves);
      __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_leaves);
      __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_leaves, __pyx_v_dirty_leaves);
      __Pyx_GIVEREF(__pyx_v_dirty_leaves);

      /* "mathics/core/expression.py":1405
 *                     dirty_leaves[index].unevaluated = True
 * 
 *             if dirty_leaves:             # <<<<<<<<<<<<<<
 *                 new = Expression(head)
 *                 new._leaves = tuple(dirty_leaves)
 */
    }

    /* "mathics/core/expression.py":1395
 *             leaf.unevaluated = False
 * 
 *         if "System`HoldAllComplete" not in attributes:             # <<<<<<<<<<<<<<
 *             dirty_leaves = None
 * 
 */
  }

  /* "mathics/core/expression.py":1410
 *                 leaves = dirty_leaves
 * 
 *         def flatten_callback(new_leaves, old):             # <<<<<<<<<<<<<<
 *             for leaf in new_leaves:
 *                 leaf.unevaluated = old.unevaluated
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_13evaluate_next_5flatten_callback, 0, __pyx_n_s_Expression_evaluate_next_locals_4, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_flatten_callback = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1414
 *                 leaf.unevaluated = old.unevaluated
 * 
 *         if "System`Flat" in attributes:             # <<<<<<<<<<<<<<
 *             new = new.flatten(new._head, callback=flatten_callback)
 *         if "System`Orderless" in attributes:
 */
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_Flat, __pyx_cur_scope->__pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1414, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1415
 * 
 *         if "System`Flat" in attributes:
 *             new = new.flatten(new._head, callback=flatten_callback)             # <<<<<<<<<<<<<<
 *         if "System`Orderless" in attributes:
 *             new.sort()
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_flatten); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_callback, __pyx_v_flatten_callback) < 0) __PYX_ERR(0, 1415, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1415, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_new, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1414
 *                 leaf.unevaluated = old.unevaluated
 * 
 *         if "System`Flat" in attributes:             # <<<<<<<<<<<<<<
 *             new = new.flatten(new._head, callback=flatten_callback)
 *         if "System`Orderless" in attributes:
 */
  }

  /* "mathics/core/expression.py":1416
 *         if "System`Flat" in attributes:
 *             new = new.flatten(new._head, callback=flatten_callback)
 *         if "System`Orderless" in attributes:             # <<<<<<<<<<<<<<
 *             new.sort()
 * 
 */
  __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_Orderless, __pyx_cur_scope->__pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1416, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_6 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":1417
 *             new = new.flatten(new._head, callback=flatten_callback)
 *         if "System`Orderless" in attributes:
 *             new.sort()             # <<<<<<<<<<<<<<
 * 
 *         new._timestamp_cache(evaluation)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_sort); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1416
 *         if "System`Flat" in attributes:
 *             new = new.flatten(new._head, callback=flatten_callback)
 *         if "System`Orderless" in attributes:             # <<<<<<<<<<<<<<
 *             new.sort()
 * 
 */
  }

  /* "mathics/core/expression.py":1419
 *             new.sort()
 * 
 *         new._timestamp_cache(evaluation)             # <<<<<<<<<<<<<<
 * 
 *         if "System`Listable" in attributes:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_timestamp_cache); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1421
 *         new._timestamp_cache(evaluation)
 * 
 *         if "System`Listable" in attributes:             # <<<<<<<<<<<<<<
 *             done, threaded = new.thread(evaluation)
 *             if done:
 */
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_Listable, __pyx_cur_scope->__pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1421, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1422
 * 
 *         if "System`Listable" in attributes:
 *             done, threaded = new.thread(evaluation)             # <<<<<<<<<<<<<<
 *             if done:
 *                 if threaded.sameQ(new):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_thread); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_evaluation);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    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, 1422, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1422, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_3)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_2), 2) < 0) __PYX_ERR(0, 1422, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L21_unpacking_done;
      __pyx_L20_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1422, __pyx_L1_error)
      __pyx_L21_unpacking_done:;
    }
    __pyx_v_done = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_threaded = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1423
 *         if "System`Listable" in attributes:
 *             done, threaded = new.thread(evaluation)
 *             if done:             # <<<<<<<<<<<<<<
 *                 if threaded.sameQ(new):
 *                     new._timestamp_cache(evaluation)
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_done); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1423, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1424
 *             done, threaded = new.thread(evaluation)
 *             if done:
 *                 if threaded.sameQ(new):             # <<<<<<<<<<<<<<
 *                     new._timestamp_cache(evaluation)
 *                     return new, False
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_threaded, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_cur_scope->__pyx_v_new) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_cur_scope->__pyx_v_new);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":1425
 *             if done:
 *                 if threaded.sameQ(new):
 *                     new._timestamp_cache(evaluation)             # <<<<<<<<<<<<<<
 *                     return new, False
 *                 else:
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_timestamp_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1425, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1425, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "mathics/core/expression.py":1426
 *                 if threaded.sameQ(new):
 *                     new._timestamp_cache(evaluation)
 *                     return new, False             # <<<<<<<<<<<<<<
 *                 else:
 *                     return threaded, True
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1426, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_cur_scope->__pyx_v_new);
        __Pyx_INCREF(Py_False);
        __Pyx_GIVEREF(Py_False);
        PyTuple_SET_ITEM(__pyx_t_4, 1, Py_False);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1424
 *             done, threaded = new.thread(evaluation)
 *             if done:
 *                 if threaded.sameQ(new):             # <<<<<<<<<<<<<<
 *                     new._timestamp_cache(evaluation)
 *                     return new, False
 */
      }

      /* "mathics/core/expression.py":1428
 *                     return new, False
 *                 else:
 *                     return threaded, True             # <<<<<<<<<<<<<<
 * 
 *         def rules():
 */
      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1428, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_threaded);
        __Pyx_GIVEREF(__pyx_v_threaded);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_threaded);
        __Pyx_INCREF(Py_True);
        __Pyx_GIVEREF(Py_True);
        PyTuple_SET_ITEM(__pyx_t_4, 1, Py_True);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        goto __pyx_L0;
      }

      /* "mathics/core/expression.py":1423
 *         if "System`Listable" in attributes:
 *             done, threaded = new.thread(evaluation)
 *             if done:             # <<<<<<<<<<<<<<
 *                 if threaded.sameQ(new):
 *                     new._timestamp_cache(evaluation)
 */
    }

    /* "mathics/core/expression.py":1421
 *         new._timestamp_cache(evaluation)
 * 
 *         if "System`Listable" in attributes:             # <<<<<<<<<<<<<<
 *             done, threaded = new.thread(evaluation)
 *             if done:
 */
  }

  /* "mathics/core/expression.py":1430
 *                     return threaded, True
 * 
 *         def rules():             # <<<<<<<<<<<<<<
 *             rules_names = set()
 *             if "System`HoldAllComplete" not in attributes:
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_13evaluate_next_7rules, 0, __pyx_n_s_Expression_evaluate_next_locals, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_rules = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1448
 *                     yield rule
 * 
 *         for rule in rules():             # <<<<<<<<<<<<<<
 *             result = rule.apply(new, evaluation, fully=False)
 *             if result is not None:
 */
  __pyx_t_4 = __pyx_pf_7mathics_4core_10expression_10Expression_13evaluate_next_6rules(__pyx_v_rules); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1448, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1448, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_8 >= 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_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1448, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1448, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_8 >= 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_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1448, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1448, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_11(__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, 1448, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_rule, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1449
 * 
 *         for rule in rules():
 *             result = rule.apply(new, evaluation, fully=False)             # <<<<<<<<<<<<<<
 *             if result is not None:
 *                 if isinstance(result, BoxConstruct):
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_rule, __pyx_n_s_apply); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_new);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_cur_scope->__pyx_v_evaluation);
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fully, Py_False) < 0) __PYX_ERR(0, 1449, __pyx_L1_error)
    __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __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_XDECREF_SET(__pyx_v_result, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "mathics/core/expression.py":1450
 *         for rule in rules():
 *             result = rule.apply(new, evaluation, fully=False)
 *             if result is not None:             # <<<<<<<<<<<<<<
 *                 if isinstance(result, BoxConstruct):
 *                     return result, False
 */
    __pyx_t_6 = (__pyx_v_result != Py_None);
    __pyx_t_5 = (__pyx_t_6 != 0);
    if (__pyx_t_5) {

      /* "mathics/core/expression.py":1451
 *             result = rule.apply(new, evaluation, fully=False)
 *             if result is not None:
 *                 if isinstance(result, BoxConstruct):             # <<<<<<<<<<<<<<
 *                     return result, False
 *                 if result.sameQ(new):
 */
      __pyx_t_5 = PyObject_IsInstance(__pyx_v_result, __pyx_v_BoxConstruct); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1451, __pyx_L1_error)
      __pyx_t_6 = (__pyx_t_5 != 0);
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":1452
 *             if result is not None:
 *                 if isinstance(result, BoxConstruct):
 *                     return result, False             # <<<<<<<<<<<<<<
 *                 if result.sameQ(new):
 *                     new._timestamp_cache(evaluation)
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1452, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_v_result);
        __Pyx_GIVEREF(__pyx_v_result);
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_result);
        __Pyx_INCREF(Py_False);
        __Pyx_GIVEREF(Py_False);
        PyTuple_SET_ITEM(__pyx_t_13, 1, Py_False);
        __pyx_r = __pyx_t_13;
        __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1451
 *             result = rule.apply(new, evaluation, fully=False)
 *             if result is not None:
 *                 if isinstance(result, BoxConstruct):             # <<<<<<<<<<<<<<
 *                     return result, False
 *                 if result.sameQ(new):
 */
      }

      /* "mathics/core/expression.py":1453
 *                 if isinstance(result, BoxConstruct):
 *                     return result, False
 *                 if result.sameQ(new):             # <<<<<<<<<<<<<<
 *                     new._timestamp_cache(evaluation)
 *                     return new, False
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1453, __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_13 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_cur_scope->__pyx_v_new) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_new);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1453, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1453, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":1454
 *                     return result, False
 *                 if result.sameQ(new):
 *                     new._timestamp_cache(evaluation)             # <<<<<<<<<<<<<<
 *                     return new, False
 *                 else:
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_timestamp_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1454, __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_13 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1454, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

        /* "mathics/core/expression.py":1455
 *                 if result.sameQ(new):
 *                     new._timestamp_cache(evaluation)
 *                     return new, False             # <<<<<<<<<<<<<<
 *                 else:
 *                     return result, True
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1455, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new);
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_cur_scope->__pyx_v_new);
        __Pyx_INCREF(Py_False);
        __Pyx_GIVEREF(Py_False);
        PyTuple_SET_ITEM(__pyx_t_13, 1, Py_False);
        __pyx_r = __pyx_t_13;
        __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1453
 *                 if isinstance(result, BoxConstruct):
 *                     return result, False
 *                 if result.sameQ(new):             # <<<<<<<<<<<<<<
 *                     new._timestamp_cache(evaluation)
 *                     return new, False
 */
      }

      /* "mathics/core/expression.py":1457
 *                     return new, False
 *                 else:
 *                     return result, True             # <<<<<<<<<<<<<<
 * 
 *         dirty_leaves = None
 */
      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1457, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_v_result);
        __Pyx_GIVEREF(__pyx_v_result);
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_result);
        __Pyx_INCREF(Py_True);
        __Pyx_GIVEREF(Py_True);
        PyTuple_SET_ITEM(__pyx_t_13, 1, Py_True);
        __pyx_r = __pyx_t_13;
        __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }

      /* "mathics/core/expression.py":1450
 *         for rule in rules():
 *             result = rule.apply(new, evaluation, fully=False)
 *             if result is not None:             # <<<<<<<<<<<<<<
 *                 if isinstance(result, BoxConstruct):
 *                     return result, False
 */
    }

    /* "mathics/core/expression.py":1448
 *                     yield rule
 * 
 *         for rule in rules():             # <<<<<<<<<<<<<<
 *             result = rule.apply(new, evaluation, fully=False)
 *             if result is not None:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1459
 *                     return result, True
 * 
 *         dirty_leaves = None             # <<<<<<<<<<<<<<
 * 
 *         # Expression did not change, re-apply Unevaluated
 */
  __Pyx_INCREF(Py_None);
  __Pyx_XDECREF_SET(__pyx_v_dirty_leaves, ((PyObject*)Py_None));

  /* "mathics/core/expression.py":1462
 * 
 *         # Expression did not change, re-apply Unevaluated
 *         for index, leaf in enumerate(new._leaves):             # <<<<<<<<<<<<<<
 *             if leaf.unevaluated:
 *                 if dirty_leaves is None:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_1 = __pyx_int_0;
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (likely(PyList_CheckExact(__pyx_t_13)) || PyTuple_CheckExact(__pyx_t_13)) {
    __pyx_t_2 = __pyx_t_13; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1462, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_13 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_13); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1462, __pyx_L1_error)
        #else
        __pyx_t_13 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1462, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_13); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1462, __pyx_L1_error)
        #else
        __pyx_t_13 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1462, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        #endif
      }
    } else {
      __pyx_t_13 = __pyx_t_11(__pyx_t_2);
      if (unlikely(!__pyx_t_13)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1462, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_13);
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_13);
    __pyx_t_13 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_1);
    __pyx_t_13 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1462, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_13;
    __pyx_t_13 = 0;

    /* "mathics/core/expression.py":1463
 *         # Expression did not change, re-apply Unevaluated
 *         for index, leaf in enumerate(new._leaves):
 *             if leaf.unevaluated:             # <<<<<<<<<<<<<<
 *                 if dirty_leaves is None:
 *                     dirty_leaves = list(new._leaves)
 */
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_unevaluated); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1463, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1463, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1464
 *         for index, leaf in enumerate(new._leaves):
 *             if leaf.unevaluated:
 *                 if dirty_leaves is None:             # <<<<<<<<<<<<<<
 *                     dirty_leaves = list(new._leaves)
 *                 dirty_leaves[index] = Expression("Unevaluated", leaf)
 */
      __pyx_t_6 = (__pyx_v_dirty_leaves == ((PyObject*)Py_None));
      __pyx_t_5 = (__pyx_t_6 != 0);
      if (__pyx_t_5) {

        /* "mathics/core/expression.py":1465
 *             if leaf.unevaluated:
 *                 if dirty_leaves is None:
 *                     dirty_leaves = list(new._leaves)             # <<<<<<<<<<<<<<
 *                 dirty_leaves[index] = Expression("Unevaluated", leaf)
 * 
 */
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1465, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_3 = PySequence_List(__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1465, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF_SET(__pyx_v_dirty_leaves, ((PyObject*)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "mathics/core/expression.py":1464
 *         for index, leaf in enumerate(new._leaves):
 *             if leaf.unevaluated:
 *                 if dirty_leaves is None:             # <<<<<<<<<<<<<<
 *                     dirty_leaves = list(new._leaves)
 *                 dirty_leaves[index] = Expression("Unevaluated", leaf)
 */
      }

      /* "mathics/core/expression.py":1466
 *                 if dirty_leaves is None:
 *                     dirty_leaves = list(new._leaves)
 *                 dirty_leaves[index] = Expression("Unevaluated", leaf)             # <<<<<<<<<<<<<<
 * 
 *         if dirty_leaves:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_Expression); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1466, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_4 = NULL;
      __pyx_t_14 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_13);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_13, function);
          __pyx_t_14 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_13)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_u_Unevaluated, __pyx_v_leaf};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1466, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_u_Unevaluated, __pyx_v_leaf};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1466, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_15 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1466, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_n_u_Unevaluated);
        __Pyx_GIVEREF(__pyx_n_u_Unevaluated);
        PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_n_u_Unevaluated);
        __Pyx_INCREF(__pyx_v_leaf);
        __Pyx_GIVEREF(__pyx_v_leaf);
        PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_v_leaf);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1466, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      }
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(__pyx_v_dirty_leaves == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 1466, __pyx_L1_error)
      }
      if (unlikely(PyObject_SetItem(__pyx_v_dirty_leaves, __pyx_v_index, __pyx_t_3) < 0)) __PYX_ERR(0, 1466, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "mathics/core/expression.py":1463
 *         # Expression did not change, re-apply Unevaluated
 *         for index, leaf in enumerate(new._leaves):
 *             if leaf.unevaluated:             # <<<<<<<<<<<<<<
 *                 if dirty_leaves is None:
 *                     dirty_leaves = list(new._leaves)
 */
    }

    /* "mathics/core/expression.py":1462
 * 
 *         # Expression did not change, re-apply Unevaluated
 *         for index, leaf in enumerate(new._leaves):             # <<<<<<<<<<<<<<
 *             if leaf.unevaluated:
 *                 if dirty_leaves is None:
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1468
 *                 dirty_leaves[index] = Expression("Unevaluated", leaf)
 * 
 *         if dirty_leaves:             # <<<<<<<<<<<<<<
 *             new = Expression(head)
 *             new._leaves = tuple(dirty_leaves)
 */
  __pyx_t_5 = (__pyx_v_dirty_leaves != Py_None)&&(PyList_GET_SIZE(__pyx_v_dirty_leaves) != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":1469
 * 
 *         if dirty_leaves:
 *             new = Expression(head)             # <<<<<<<<<<<<<<
 *             new._leaves = tuple(dirty_leaves)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_head);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_new);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_new, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1470
 *         if dirty_leaves:
 *             new = Expression(head)
 *             new._leaves = tuple(dirty_leaves)             # <<<<<<<<<<<<<<
 * 
 *         new.unformatted = self.unformatted
 */
    if (unlikely(__pyx_v_dirty_leaves == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1470, __pyx_L1_error)
    }
    __pyx_t_1 = PyList_AsTuple(__pyx_v_dirty_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_leaves_2, __pyx_t_1) < 0) __PYX_ERR(0, 1470, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1468
 *                 dirty_leaves[index] = Expression("Unevaluated", leaf)
 * 
 *         if dirty_leaves:             # <<<<<<<<<<<<<<
 *             new = Expression(head)
 *             new._leaves = tuple(dirty_leaves)
 */
  }

  /* "mathics/core/expression.py":1472
 *             new._leaves = tuple(dirty_leaves)
 * 
 *         new.unformatted = self.unformatted             # <<<<<<<<<<<<<<
 *         new._timestamp_cache(evaluation)
 *         return new, False
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_unformatted); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_unformatted, __pyx_t_1) < 0) __PYX_ERR(0, 1472, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1473
 * 
 *         new.unformatted = self.unformatted
 *         new._timestamp_cache(evaluation)             # <<<<<<<<<<<<<<
 *         return new, False
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_new, __pyx_n_s_timestamp_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1473, __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_cur_scope->__pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1474
 *         new.unformatted = self.unformatted
 *         new._timestamp_cache(evaluation)
 *         return new, False             # <<<<<<<<<<<<<<
 * 
 *     def evaluate_leaves(self, evaluation) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_new);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_new);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_new);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  PyTuple_SET_ITEM(__pyx_t_1, 1, Py_False);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1345
 *         return expr
 * 
 *     def evaluate_next(self, evaluation) -> typing.Tuple["Expression", bool]:             # <<<<<<<<<<<<<<
 *         from mathics.builtin.base import BoxConstruct
 * 
 */

  /* 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_13);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate_next", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_BoxConstruct);
  __Pyx_XDECREF(__pyx_v_head);
  __Pyx_XDECREF(__pyx_v_rest_range);
  __Pyx_XDECREF(__pyx_v_eval_range);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_v_dirty_leaves);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_flatten_callback);
  __Pyx_XDECREF(__pyx_v_done);
  __Pyx_XDECREF(__pyx_v_threaded);
  __Pyx_XDECREF(__pyx_v_rules);
  __Pyx_XDECREF(__pyx_v_rule);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1476
 *         return new, False
 * 
 *     def evaluate_leaves(self, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         leaves = [leaf.evaluate(evaluation) for leaf in self._leaves]
 *         head = self._head.evaluate_leaves(evaluation)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_79evaluate_leaves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_79evaluate_leaves = {"evaluate_leaves", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_79evaluate_leaves, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_79evaluate_leaves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate_leaves (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate_leaves", 1, 2, 2, 1); __PYX_ERR(0, 1476, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate_leaves") < 0)) __PYX_ERR(0, 1476, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate_leaves", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1476, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate_leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_78evaluate_leaves(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_78evaluate_leaves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_v_head = NULL;
  PyObject *__pyx_9genexpr19__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate_leaves", 0);

  /* "mathics/core/expression.py":1477
 * 
 *     def evaluate_leaves(self, evaluation) -> "Expression":
 *         leaves = [leaf.evaluate(evaluation) for leaf in self._leaves]             # <<<<<<<<<<<<<<
 *         head = self._head.evaluate_leaves(evaluation)
 *         return Expression(head, *leaves)
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1477, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1477, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1477, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1477, __pyx_L5_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1477, __pyx_L5_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1477, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr19__pyx_v_leaf, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr19__pyx_v_leaf, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1477, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_evaluation);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 1477, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_leaf); __pyx_9genexpr19__pyx_v_leaf = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_leaf); __pyx_9genexpr19__pyx_v_leaf = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_v_leaves = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1478
 *     def evaluate_leaves(self, evaluation) -> "Expression":
 *         leaves = [leaf.evaluate(evaluation) for leaf in self._leaves]
 *         head = self._head.evaluate_leaves(evaluation)             # <<<<<<<<<<<<<<
 *         return Expression(head, *leaves)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_evaluate_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1478, __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_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_head = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1479
 *         leaves = [leaf.evaluate(evaluation) for leaf in self._leaves]
 *         head = self._head.evaluate_leaves(evaluation)
 *         return Expression(head, *leaves)             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_head);
  __Pyx_GIVEREF(__pyx_v_head);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_head);
  __pyx_t_3 = PySequence_Tuple(__pyx_v_leaves); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1476
 *         return new, False
 * 
 *     def evaluate_leaves(self, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         leaves = [leaf.evaluate(evaluation) for leaf in self._leaves]
 *         head = self._head.evaluate_leaves(evaluation)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.Expression.evaluate_leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_v_head);
  __Pyx_XDECREF(__pyx_9genexpr19__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1481
 *         return Expression(head, *leaves)
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[%s]" % (
 *             self._head,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_81__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_81__str__ = {"__str__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_81__str__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_81__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_80__str__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_80__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_9genexpr20__pyx_v_leaf = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  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("__str__", 0);

  /* "mathics/core/expression.py":1482
 * 
 *     def __str__(self) -> str:
 *         return "%s[%s]" % (             # <<<<<<<<<<<<<<
 *             self._head,
 *             ", ".join([leaf.__str__() for leaf in self._leaves]),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;

  /* "mathics/core/expression.py":1483
 *     def __str__(self) -> str:
 *         return "%s[%s]" % (
 *             self._head,             # <<<<<<<<<<<<<<
 *             ", ".join([leaf.__str__() for leaf in self._leaves]),
 *         )
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1483, __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, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__33);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__33);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__33);

  /* "mathics/core/expression.py":1484
 *         return "%s[%s]" % (
 *             self._head,
 *             ", ".join([leaf.__str__() for leaf in self._leaves]),             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  { /* enter inner scope */
    __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1484, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1484, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_6 = __pyx_t_4; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1484, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1484, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1484, __pyx_L5_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1484, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1484, __pyx_L5_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1484, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_8(__pyx_t_6);
        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, 1484, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr20__pyx_v_leaf, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr20__pyx_v_leaf, __pyx_n_s_str); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1484, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1484, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 1484, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_leaf); __pyx_9genexpr20__pyx_v_leaf = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_leaf); __pyx_9genexpr20__pyx_v_leaf = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_t_6 = PyUnicode_Join(__pyx_kp_u__34, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1484, __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, 2, __pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_kp_u__35);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__35);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__35);

  /* "mathics/core/expression.py":1482
 * 
 *     def __str__(self) -> str:
 *         return "%s[%s]" % (             # <<<<<<<<<<<<<<
 *             self._head,
 *             ", ".join([leaf.__str__() for leaf in self._leaves]),
 */
  __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1481
 *         return Expression(head, *leaves)
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[%s]" % (
 *             self._head,
 */

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.Expression.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_9genexpr20__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1487
 *         )
 * 
 *     def __repr__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "<Expression: %s>" % self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_83__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_83__repr__ = {"__repr__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_83__repr__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_83__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_82__repr__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":1488
 * 
 *     def __repr__(self) -> str:
 *         return "<Expression: %s>" % self             # <<<<<<<<<<<<<<
 * 
 *     def process_style_box(self, options):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_Expression_s, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1487
 *         )
 * 
 *     def __repr__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "<Expression: %s>" % self
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Expression.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1490
 *         return "<Expression: %s>" % self
 * 
 *     def process_style_box(self, options):             # <<<<<<<<<<<<<<
 *         if self.has_form("StyleBox", 1, None):
 *             rules = self._leaves[1:]
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_85process_style_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_85process_style_box = {"process_style_box", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_85process_style_box, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_85process_style_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("process_style_box (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_options,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_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("process_style_box", 1, 2, 2, 1); __PYX_ERR(0, 1490, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "process_style_box") < 0)) __PYX_ERR(0, 1490, __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_options = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("process_style_box", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1490, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.process_style_box", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_84process_style_box(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_84process_style_box(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options) {
  PyObject *__pyx_v_rules = NULL;
  PyObject *__pyx_v_rule = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_m1 = NULL;
  PyObject *__pyx_v_m2 = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("process_style_box", 0);
  __Pyx_INCREF(__pyx_v_options);

  /* "mathics/core/expression.py":1491
 * 
 *     def process_style_box(self, options):
 *         if self.has_form("StyleBox", 1, None):             # <<<<<<<<<<<<<<
 *             rules = self._leaves[1:]
 *             for rule in rules:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_has_form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":1492
 *     def process_style_box(self, options):
 *         if self.has_form("StyleBox", 1, None):
 *             rules = self._leaves[1:]             # <<<<<<<<<<<<<<
 *             for rule in rules:
 *                 if rule.has_form("Rule", 2):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 1, 0, NULL, NULL, &__pyx_slice__37, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1492, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_rules = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1493
 *         if self.has_form("StyleBox", 1, None):
 *             rules = self._leaves[1:]
 *             for rule in rules:             # <<<<<<<<<<<<<<
 *                 if rule.has_form("Rule", 2):
 *                     name = rule._leaves[0].get_name()
 */
    if (likely(PyList_CheckExact(__pyx_v_rules)) || PyTuple_CheckExact(__pyx_v_rules)) {
      __pyx_t_1 = __pyx_v_rules; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1493, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1493, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1493, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1493, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1493, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_rule, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1494
 *             rules = self._leaves[1:]
 *             for rule in rules:
 *                 if rule.has_form("Rule", 2):             # <<<<<<<<<<<<<<
 *                     name = rule._leaves[0].get_name()
 *                     value = rule._leaves[1]
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_rule, __pyx_n_s_has_form); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_3) {

        /* "mathics/core/expression.py":1495
 *             for rule in rules:
 *                 if rule.has_form("Rule", 2):
 *                     name = rule._leaves[0].get_name()             # <<<<<<<<<<<<<<
 *                     value = rule._leaves[1]
 *                     if name == "System`ShowStringCharacters":
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_rule, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_get_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "mathics/core/expression.py":1496
 *                 if rule.has_form("Rule", 2):
 *                     name = rule._leaves[0].get_name()
 *                     value = rule._leaves[1]             # <<<<<<<<<<<<<<
 *                     if name == "System`ShowStringCharacters":
 *                         value = value.is_true()
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_rule, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1496, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1496, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1497
 *                     name = rule._leaves[0].get_name()
 *                     value = rule._leaves[1]
 *                     if name == "System`ShowStringCharacters":             # <<<<<<<<<<<<<<
 *                         value = value.is_true()
 *                         options = options.copy()
 */
        __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_ShowStringCharacters, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1497, __pyx_L1_error)
        if (__pyx_t_3) {

          /* "mathics/core/expression.py":1498
 *                     value = rule._leaves[1]
 *                     if name == "System`ShowStringCharacters":
 *                         value = value.is_true()             # <<<<<<<<<<<<<<
 *                         options = options.copy()
 *                         options["show_string_characters"] = value
 */
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_is_true); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1498, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1498, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "mathics/core/expression.py":1499
 *                     if name == "System`ShowStringCharacters":
 *                         value = value.is_true()
 *                         options = options.copy()             # <<<<<<<<<<<<<<
 *                         options["show_string_characters"] = value
 *                     elif name == "System`ImageSizeMultipliers":
 */
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_copy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1499, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1499, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "mathics/core/expression.py":1500
 *                         value = value.is_true()
 *                         options = options.copy()
 *                         options["show_string_characters"] = value             # <<<<<<<<<<<<<<
 *                     elif name == "System`ImageSizeMultipliers":
 *                         if value.has_form("List", 2):
 */
          if (unlikely(PyObject_SetItem(__pyx_v_options, __pyx_n_u_show_string_characters, __pyx_v_value) < 0)) __PYX_ERR(0, 1500, __pyx_L1_error)

          /* "mathics/core/expression.py":1497
 *                     name = rule._leaves[0].get_name()
 *                     value = rule._leaves[1]
 *                     if name == "System`ShowStringCharacters":             # <<<<<<<<<<<<<<
 *                         value = value.is_true()
 *                         options = options.copy()
 */
          goto __pyx_L7;
        }

        /* "mathics/core/expression.py":1501
 *                         options = options.copy()
 *                         options["show_string_characters"] = value
 *                     elif name == "System`ImageSizeMultipliers":             # <<<<<<<<<<<<<<
 *                         if value.has_form("List", 2):
 *                             m1 = value._leaves[0].round_to_float()
 */
        __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_ImageSizeMultipliers, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1501, __pyx_L1_error)
        if (__pyx_t_3) {

          /* "mathics/core/expression.py":1502
 *                         options["show_string_characters"] = value
 *                     elif name == "System`ImageSizeMultipliers":
 *                         if value.has_form("List", 2):             # <<<<<<<<<<<<<<
 *                             m1 = value._leaves[0].round_to_float()
 *                             m2 = value._leaves[1].round_to_float()
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_has_form); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1502, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1502, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1502, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (__pyx_t_3) {

            /* "mathics/core/expression.py":1503
 *                     elif name == "System`ImageSizeMultipliers":
 *                         if value.has_form("List", 2):
 *                             m1 = value._leaves[0].round_to_float()             # <<<<<<<<<<<<<<
 *                             m2 = value._leaves[1].round_to_float()
 *                             if m1 is not None and m2 is not None:
 */
            __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1503, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1503, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_round_to_float); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1503, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
              __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
              if (likely(__pyx_t_7)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
                __Pyx_INCREF(__pyx_t_7);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_2, function);
              }
            }
            __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1503, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF_SET(__pyx_v_m1, __pyx_t_6);
            __pyx_t_6 = 0;

            /* "mathics/core/expression.py":1504
 *                         if value.has_form("List", 2):
 *                             m1 = value._leaves[0].round_to_float()
 *                             m2 = value._leaves[1].round_to_float()             # <<<<<<<<<<<<<<
 *                             if m1 is not None and m2 is not None:
 *                                 options = options.copy()
 */
            __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1504, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1504, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_round_to_float); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1504, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
              __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
              if (likely(__pyx_t_7)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
                __Pyx_INCREF(__pyx_t_7);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_2, function);
              }
            }
            __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1504, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF_SET(__pyx_v_m2, __pyx_t_6);
            __pyx_t_6 = 0;

            /* "mathics/core/expression.py":1505
 *                             m1 = value._leaves[0].round_to_float()
 *                             m2 = value._leaves[1].round_to_float()
 *                             if m1 is not None and m2 is not None:             # <<<<<<<<<<<<<<
 *                                 options = options.copy()
 *                                 options["image_size_multipliers"] = (m1, m2)
 */
            __pyx_t_8 = (__pyx_v_m1 != Py_None);
            __pyx_t_9 = (__pyx_t_8 != 0);
            if (__pyx_t_9) {
            } else {
              __pyx_t_3 = __pyx_t_9;
              goto __pyx_L10_bool_binop_done;
            }
            __pyx_t_9 = (__pyx_v_m2 != Py_None);
            __pyx_t_8 = (__pyx_t_9 != 0);
            __pyx_t_3 = __pyx_t_8;
            __pyx_L10_bool_binop_done:;
            if (__pyx_t_3) {

              /* "mathics/core/expression.py":1506
 *                             m2 = value._leaves[1].round_to_float()
 *                             if m1 is not None and m2 is not None:
 *                                 options = options.copy()             # <<<<<<<<<<<<<<
 *                                 options["image_size_multipliers"] = (m1, m2)
 *             return True, options
 */
              __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1506, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_7 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
                __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
                if (likely(__pyx_t_7)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
                  __Pyx_INCREF(__pyx_t_7);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_2, function);
                }
              }
              __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
              __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
              if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1506, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_6);
              __pyx_t_6 = 0;

              /* "mathics/core/expression.py":1507
 *                             if m1 is not None and m2 is not None:
 *                                 options = options.copy()
 *                                 options["image_size_multipliers"] = (m1, m2)             # <<<<<<<<<<<<<<
 *             return True, options
 *         else:
 */
              __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1507, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_INCREF(__pyx_v_m1);
              __Pyx_GIVEREF(__pyx_v_m1);
              PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_m1);
              __Pyx_INCREF(__pyx_v_m2);
              __Pyx_GIVEREF(__pyx_v_m2);
              PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_m2);
              if (unlikely(PyObject_SetItem(__pyx_v_options, __pyx_n_u_image_size_multipliers, __pyx_t_6) < 0)) __PYX_ERR(0, 1507, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

              /* "mathics/core/expression.py":1505
 *                             m1 = value._leaves[0].round_to_float()
 *                             m2 = value._leaves[1].round_to_float()
 *                             if m1 is not None and m2 is not None:             # <<<<<<<<<<<<<<
 *                                 options = options.copy()
 *                                 options["image_size_multipliers"] = (m1, m2)
 */
            }

            /* "mathics/core/expression.py":1502
 *                         options["show_string_characters"] = value
 *                     elif name == "System`ImageSizeMultipliers":
 *                         if value.has_form("List", 2):             # <<<<<<<<<<<<<<
 *                             m1 = value._leaves[0].round_to_float()
 *                             m2 = value._leaves[1].round_to_float()
 */
          }

          /* "mathics/core/expression.py":1501
 *                         options = options.copy()
 *                         options["show_string_characters"] = value
 *                     elif name == "System`ImageSizeMultipliers":             # <<<<<<<<<<<<<<
 *                         if value.has_form("List", 2):
 *                             m1 = value._leaves[0].round_to_float()
 */
        }
        __pyx_L7:;

        /* "mathics/core/expression.py":1494
 *             rules = self._leaves[1:]
 *             for rule in rules:
 *                 if rule.has_form("Rule", 2):             # <<<<<<<<<<<<<<
 *                     name = rule._leaves[0].get_name()
 *                     value = rule._leaves[1]
 */
      }

      /* "mathics/core/expression.py":1493
 *         if self.has_form("StyleBox", 1, None):
 *             rules = self._leaves[1:]
 *             for rule in rules:             # <<<<<<<<<<<<<<
 *                 if rule.has_form("Rule", 2):
 *                     name = rule._leaves[0].get_name()
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1508
 *                                 options = options.copy()
 *                                 options["image_size_multipliers"] = (m1, m2)
 *             return True, options             # <<<<<<<<<<<<<<
 *         else:
 *             return False, options
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(Py_True);
    __Pyx_GIVEREF(Py_True);
    PyTuple_SET_ITEM(__pyx_t_1, 0, Py_True);
    __Pyx_INCREF(__pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_options);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1491
 * 
 *     def process_style_box(self, options):
 *         if self.has_form("StyleBox", 1, None):             # <<<<<<<<<<<<<<
 *             rules = self._leaves[1:]
 *             for rule in rules:
 */
  }

  /* "mathics/core/expression.py":1510
 *             return True, options
 *         else:
 *             return False, options             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_text(self, **options) -> str:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(Py_False);
    __Pyx_GIVEREF(Py_False);
    PyTuple_SET_ITEM(__pyx_t_1, 0, Py_False);
    __Pyx_INCREF(__pyx_v_options);
    __Pyx_GIVEREF(__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_options);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":1490
 *         return "<Expression: %s>" % self
 * 
 *     def process_style_box(self, options):             # <<<<<<<<<<<<<<
 *         if self.has_form("StyleBox", 1, None):
 *             rules = self._leaves[1:]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.Expression.process_style_box", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rules);
  __Pyx_XDECREF(__pyx_v_rule);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_m1);
  __Pyx_XDECREF(__pyx_v_m2);
  __Pyx_XDECREF(__pyx_v_options);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1512
 *             return False, options
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_87boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_87boxes_to_text = {"boxes_to_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_87boxes_to_text, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_87boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_text (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_text") < 0)) __PYX_ERR(0, 1512, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_text", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1512, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.Expression.boxes_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_86boxes_to_text(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_86boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options) {
  PyObject *__pyx_v_is_style = NULL;
  PyObject *__pyx_9genexpr21__pyx_v_leaf = NULL;
  PyObject *__pyx_9genexpr22__pyx_v_leaf = NULL;
  PyObject *__pyx_9genexpr23__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("boxes_to_text", 0);
  __Pyx_INCREF(__pyx_v_options);

  /* "mathics/core/expression.py":1513
 * 
 *     def boxes_to_text(self, **options) -> str:
 *         is_style, options = self.process_style_box(options)             # <<<<<<<<<<<<<<
 *         if is_style:
 *             return self._leaves[0].boxes_to_text(**options)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_process_style_box); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1513, __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_options) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_options);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1513, __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, 1513, __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, 1513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1513, __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, 1513, __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, 1513, __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, 1513, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_is_style = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "mathics/core/expression.py":1514
 *     def boxes_to_text(self, **options) -> str:
 *         is_style, options = self.process_style_box(options)
 *         if is_style:             # <<<<<<<<<<<<<<
 *             return self._leaves[0].boxes_to_text(**options)
 *         if self.has_form("RowBox", 1) and self._leaves[0].has_form(  # nopep8
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_is_style); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1514, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1515
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 *             return self._leaves[0].boxes_to_text(**options)             # <<<<<<<<<<<<<<
 *         if self.has_form("RowBox", 1) and self._leaves[0].has_form(  # nopep8
 *             "List", None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_boxes_to_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1515, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_3 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1515, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1515, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1515, __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 (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1515, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1514
 *     def boxes_to_text(self, **options) -> str:
 *         is_style, options = self.process_style_box(options)
 *         if is_style:             # <<<<<<<<<<<<<<
 *             return self._leaves[0].boxes_to_text(**options)
 *         if self.has_form("RowBox", 1) and self._leaves[0].has_form(  # nopep8
 */
  }

  /* "mathics/core/expression.py":1516
 *         if is_style:
 *             return self._leaves[0].boxes_to_text(**options)
 *         if self.has_form("RowBox", 1) and self._leaves[0].has_form(  # nopep8             # <<<<<<<<<<<<<<
 *             "List", None
 *         ):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_has_form); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_has_form); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1517
 *             return self._leaves[0].boxes_to_text(**options)
 *         if self.has_form("RowBox", 1) and self._leaves[0].has_form(  # nopep8
 *             "List", None             # <<<<<<<<<<<<<<
 *         ):
 *             return "".join(
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":1516
 *         if is_style:
 *             return self._leaves[0].boxes_to_text(**options)
 *         if self.has_form("RowBox", 1) and self._leaves[0].has_form(  # nopep8             # <<<<<<<<<<<<<<
 *             "List", None
 *         ):
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __pyx_t_7;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1519
 *             "List", None
 *         ):
 *             return "".join(             # <<<<<<<<<<<<<<
 *                 [leaf.boxes_to_text(**options) for leaf in self._leaves[0]._leaves]
 *             )
 */
    __Pyx_XDECREF(__pyx_r);
    { /* enter inner scope */

      /* "mathics/core/expression.py":1520
 *         ):
 *             return "".join(
 *                 [leaf.boxes_to_text(**options) for leaf in self._leaves[0]._leaves]             # <<<<<<<<<<<<<<
 *             )
 *         elif self.has_form("SuperscriptBox", 2):
 */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1520, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1520, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1520, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1520, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
        __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
      } else {
        __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1520, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1520, __pyx_L11_error)
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      for (;;) {
        if (likely(!__pyx_t_9)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1520, __pyx_L11_error)
            #else
            __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1520, __pyx_L11_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          } else {
            if (__pyx_t_8 >= 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_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1520, __pyx_L11_error)
            #else
            __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1520, __pyx_L11_error)
            __Pyx_GOTREF(__pyx_t_3);
            #endif
          }
        } else {
          __pyx_t_3 = __pyx_t_9(__pyx_t_1);
          if (unlikely(!__pyx_t_3)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1520, __pyx_L11_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_3);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr21__pyx_v_leaf, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr21__pyx_v_leaf, __pyx_n_s_boxes_to_text); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1520, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (unlikely(__pyx_v_options == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
          __PYX_ERR(0, 1520, __pyx_L11_error)
        }
        if (likely(PyDict_CheckExact(__pyx_v_options))) {
          __pyx_t_4 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1520, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_4);
        } else {
          __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1520, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1520, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 1520, __pyx_L11_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_leaf); __pyx_9genexpr21__pyx_v_leaf = 0;
      goto __pyx_L14_exit_scope;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_leaf); __pyx_9genexpr21__pyx_v_leaf = 0;
      goto __pyx_L1_error;
      __pyx_L14_exit_scope:;
    } /* exit inner scope */

    /* "mathics/core/expression.py":1519
 *             "List", None
 *         ):
 *             return "".join(             # <<<<<<<<<<<<<<
 *                 [leaf.boxes_to_text(**options) for leaf in self._leaves[0]._leaves]
 *             )
 */
    __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1516
 *         if is_style:
 *             return self._leaves[0].boxes_to_text(**options)
 *         if self.has_form("RowBox", 1) and self._leaves[0].has_form(  # nopep8             # <<<<<<<<<<<<<<
 *             "List", None
 *         ):
 */
  }

  /* "mathics/core/expression.py":1522
 *                 [leaf.boxes_to_text(**options) for leaf in self._leaves[0]._leaves]
 *             )
 *         elif self.has_form("SuperscriptBox", 2):             # <<<<<<<<<<<<<<
 *             return "^".join([leaf.boxes_to_text(**options) for leaf in self._leaves])
 *         elif self.has_form("FractionBox", 2):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_has_form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1522, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1523
 *             )
 *         elif self.has_form("SuperscriptBox", 2):
 *             return "^".join([leaf.boxes_to_text(**options) for leaf in self._leaves])             # <<<<<<<<<<<<<<
 *         elif self.has_form("FractionBox", 2):
 *             return "/".join(
 */
    __Pyx_XDECREF(__pyx_r);
    { /* enter inner scope */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1523, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
        __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
      } else {
        __pyx_t_8 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1523, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_9 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1523, __pyx_L17_error)
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        if (likely(!__pyx_t_9)) {
          if (likely(PyList_CheckExact(__pyx_t_10))) {
            if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_10)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1523, __pyx_L17_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L17_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          } else {
            if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1523, __pyx_L17_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L17_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          }
        } else {
          __pyx_t_1 = __pyx_t_9(__pyx_t_10);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1523, __pyx_L17_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr22__pyx_v_leaf, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr22__pyx_v_leaf, __pyx_n_s_boxes_to_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(__pyx_v_options == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
          __PYX_ERR(0, 1523, __pyx_L17_error)
        }
        if (likely(PyDict_CheckExact(__pyx_v_options))) {
          __pyx_t_4 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1523, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_4);
        } else {
          __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1523, __pyx_L17_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1523, __pyx_L17_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1523, __pyx_L17_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_leaf); __pyx_9genexpr22__pyx_v_leaf = 0;
      goto __pyx_L20_exit_scope;
      __pyx_L17_error:;
      __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_leaf); __pyx_9genexpr22__pyx_v_leaf = 0;
      goto __pyx_L1_error;
      __pyx_L20_exit_scope:;
    } /* exit inner scope */
    __pyx_t_10 = PyUnicode_Join(__pyx_kp_u__42, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = ((PyObject*)__pyx_t_10);
    __pyx_t_10 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1522
 *                 [leaf.boxes_to_text(**options) for leaf in self._leaves[0]._leaves]
 *             )
 *         elif self.has_form("SuperscriptBox", 2):             # <<<<<<<<<<<<<<
 *             return "^".join([leaf.boxes_to_text(**options) for leaf in self._leaves])
 *         elif self.has_form("FractionBox", 2):
 */
  }

  /* "mathics/core/expression.py":1524
 *         elif self.has_form("SuperscriptBox", 2):
 *             return "^".join([leaf.boxes_to_text(**options) for leaf in self._leaves])
 *         elif self.has_form("FractionBox", 2):             # <<<<<<<<<<<<<<
 *             return "/".join(
 *                 [" ( " + leaf.boxes_to_text(**options) + " ) " for leaf in self._leaves]
 */
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_has_form); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1524, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(__pyx_t_6)) {

    /* "mathics/core/expression.py":1525
 *             return "^".join([leaf.boxes_to_text(**options) for leaf in self._leaves])
 *         elif self.has_form("FractionBox", 2):
 *             return "/".join(             # <<<<<<<<<<<<<<
 *                 [" ( " + leaf.boxes_to_text(**options) + " ) " for leaf in self._leaves]
 *             )
 */
    __Pyx_XDECREF(__pyx_r);
    { /* enter inner scope */

      /* "mathics/core/expression.py":1526
 *         elif self.has_form("FractionBox", 2):
 *             return "/".join(
 *                 [" ( " + leaf.boxes_to_text(**options) + " ) " for leaf in self._leaves]             # <<<<<<<<<<<<<<
 *             )
 *         else:
 */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1526, __pyx_L23_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1526, __pyx_L23_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) {
        __pyx_t_3 = __pyx_t_10; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
      } else {
        __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1526, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1526, __pyx_L23_error)
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      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_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1526, __pyx_L23_error)
            #else
            __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1526, __pyx_L23_error)
            __Pyx_GOTREF(__pyx_t_10);
            #endif
          } else {
            if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1526, __pyx_L23_error)
            #else
            __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1526, __pyx_L23_error)
            __Pyx_GOTREF(__pyx_t_10);
            #endif
          }
        } else {
          __pyx_t_10 = __pyx_t_9(__pyx_t_3);
          if (unlikely(!__pyx_t_10)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1526, __pyx_L23_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_10);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr23__pyx_v_leaf, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr23__pyx_v_leaf, __pyx_n_s_boxes_to_text); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1526, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (unlikely(__pyx_v_options == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
          __PYX_ERR(0, 1526, __pyx_L23_error)
        }
        if (likely(PyDict_CheckExact(__pyx_v_options))) {
          __pyx_t_4 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1526, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_4);
        } else {
          __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1526, __pyx_L23_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1526, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Add(__pyx_kp_u__45, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1526, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_kp_u__46); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1526, __pyx_L23_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 1526, __pyx_L23_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_leaf); __pyx_9genexpr23__pyx_v_leaf = 0;
      goto __pyx_L26_exit_scope;
      __pyx_L23_error:;
      __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_leaf); __pyx_9genexpr23__pyx_v_leaf = 0;
      goto __pyx_L1_error;
      __pyx_L26_exit_scope:;
    } /* exit inner scope */

    /* "mathics/core/expression.py":1525
 *             return "^".join([leaf.boxes_to_text(**options) for leaf in self._leaves])
 *         elif self.has_form("FractionBox", 2):
 *             return "/".join(             # <<<<<<<<<<<<<<
 *                 [" ( " + leaf.boxes_to_text(**options) + " ) " for leaf in self._leaves]
 *             )
 */
    __pyx_t_3 = PyUnicode_Join(__pyx_kp_u__44, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1525, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1524
 *         elif self.has_form("SuperscriptBox", 2):
 *             return "^".join([leaf.boxes_to_text(**options) for leaf in self._leaves])
 *         elif self.has_form("FractionBox", 2):             # <<<<<<<<<<<<<<
 *             return "/".join(
 *                 [" ( " + leaf.boxes_to_text(**options) + " ) " for leaf in self._leaves]
 */
  }

  /* "mathics/core/expression.py":1529
 *             )
 *         else:
 *             raise BoxError(self, "text")             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_mathml(self, **options) -> str:
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BoxError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_11 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_self, __pyx_n_u_text};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1529, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_self, __pyx_n_u_text};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1529, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_v_self);
      __Pyx_INCREF(__pyx_n_u_text);
      __Pyx_GIVEREF(__pyx_n_u_text);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_n_u_text);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1529, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 1529, __pyx_L1_error)
  }

  /* "mathics/core/expression.py":1512
 *             return False, options
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.Expression.boxes_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_options);
  __Pyx_XDECREF(__pyx_v_is_style);
  __Pyx_XDECREF(__pyx_9genexpr21__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_9genexpr22__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_9genexpr23__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1531
 *             raise BoxError(self, "text")
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_89boxes_to_mathml(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_89boxes_to_mathml = {"boxes_to_mathml", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_89boxes_to_mathml, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_89boxes_to_mathml(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_mathml (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_mathml") < 0)) __PYX_ERR(0, 1531, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_mathml", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1531, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.Expression.boxes_to_mathml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_88boxes_to_mathml(__pyx_self, __pyx_v_self, __pyx_v_options);

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

/* "mathics/core/expression.py":1546
 *             options = options.copy()
 * 
 *             def is_list_interior(content):             # <<<<<<<<<<<<<<
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_15boxes_to_mathml_1is_list_interior(PyObject *__pyx_self, PyObject *__pyx_v_content); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_15boxes_to_mathml_1is_list_interior = {"is_list_interior", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_15boxes_to_mathml_1is_list_interior, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_15boxes_to_mathml_1is_list_interior(PyObject *__pyx_self, PyObject *__pyx_v_content) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_list_interior (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_15boxes_to_mathml_is_list_interior(__pyx_self, ((PyObject *)__pyx_v_content));

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

/* "mathics/core/expression.py":1548
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]             # <<<<<<<<<<<<<<
 *                 ):
 *                     return True
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_15boxes_to_mathml_16is_list_interior_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_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_7mathics_4core_10expression___pyx_scope_struct_21_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_21_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_21_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1548, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *) __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_7mathics_4core_10expression_10Expression_15boxes_to_mathml_16is_list_interior_2generator10, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Expression_boxes_to_mathml_local, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 1548, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.boxes_to_mathml.is_list_interior.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_7mathics_4core_10expression_10Expression_15boxes_to_mathml_16is_list_interior_2generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1548, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_content)) { __Pyx_RaiseClosureNameError("content"); __PYX_ERR(0, 1548, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_content, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_slice__47); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1548, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1548, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1548, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1548, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1548, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_leaf);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_leaf, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_leaf, __pyx_n_s_get_string_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1548, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u__48, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1548, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = ((!__pyx_t_7) != 0);
    if (__pyx_t_8) {

      /* "mathics/core/expression.py":1547
 * 
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(             # <<<<<<<<<<<<<<
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 *                 ):
 */
      __Pyx_XDECREF(__pyx_r);

      /* "mathics/core/expression.py":1548
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]             # <<<<<<<<<<<<<<
 *                 ):
 *                     return True
 */
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {

    /* "mathics/core/expression.py":1547
 * 
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(             # <<<<<<<<<<<<<<
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 *                 ):
 */
    __Pyx_XDECREF(__pyx_r);

    /* "mathics/core/expression.py":1548
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]             # <<<<<<<<<<<<<<
 *                 ):
 *                     return True
 */
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

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

/* "mathics/core/expression.py":1546
 *             options = options.copy()
 * 
 *             def is_list_interior(content):             # <<<<<<<<<<<<<<
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_15boxes_to_mathml_is_list_interior(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_content) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_list_interior", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1546, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_content = __pyx_v_content;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_content);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_content);

  /* "mathics/core/expression.py":1547
 * 
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(             # <<<<<<<<<<<<<<
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 *                 ):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_content, __pyx_n_s_has_form); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1547, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }

  /* "mathics/core/expression.py":1548
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]             # <<<<<<<<<<<<<<
 *                 ):
 *                     return True
 */
  __pyx_t_3 = __pyx_pf_7mathics_4core_10expression_10Expression_15boxes_to_mathml_16is_list_interior_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1548, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;

  /* "mathics/core/expression.py":1547
 * 
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(             # <<<<<<<<<<<<<<
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 *                 ):
 */
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":1550
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 *                 ):
 *                     return True             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1547
 * 
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(             # <<<<<<<<<<<<<<
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 *                 ):
 */
  }

  /* "mathics/core/expression.py":1551
 *                 ):
 *                     return True
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *             is_list_row = False
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1546
 *             options = options.copy()
 * 
 *             def is_list_interior(content):             # <<<<<<<<<<<<<<
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Expression.boxes_to_mathml.is_list_interior", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1531
 *             raise BoxError(self, "text")
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_88boxes_to_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options) {
  PyObject *__pyx_v_is_style = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_inside_row = NULL;
  PyObject *__pyx_v_is_list_interior = 0;
  int __pyx_v_is_list_row;
  PyObject *__pyx_v_content = NULL;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  Py_UCS4 __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("boxes_to_mathml", 0);
  __Pyx_INCREF(__pyx_v_options);

  /* "mathics/core/expression.py":1532
 * 
 *     def boxes_to_mathml(self, **options) -> str:
 *         is_style, options = self.process_style_box(options)             # <<<<<<<<<<<<<<
 *         if is_style:
 *             return self._leaves[0].boxes_to_mathml(**options)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_process_style_box); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1532, __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_options) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_options);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1532, __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, 1532, __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, 1532, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1532, __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, 1532, __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, 1532, __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, 1532, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_is_style = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "mathics/core/expression.py":1533
 *     def boxes_to_mathml(self, **options) -> str:
 *         is_style, options = self.process_style_box(options)
 *         if is_style:             # <<<<<<<<<<<<<<
 *             return self._leaves[0].boxes_to_mathml(**options)
 *         name = self._head.get_name()
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_is_style); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1533, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1534
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 *             return self._leaves[0].boxes_to_mathml(**options)             # <<<<<<<<<<<<<<
 *         name = self._head.get_name()
 *         if (
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1534, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_3 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1534, __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 (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1534, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1533
 *     def boxes_to_mathml(self, **options) -> str:
 *         is_style, options = self.process_style_box(options)
 *         if is_style:             # <<<<<<<<<<<<<<
 *             return self._leaves[0].boxes_to_mathml(**options)
 *         name = self._head.get_name()
 */
  }

  /* "mathics/core/expression.py":1535
 *         if is_style:
 *             return self._leaves[0].boxes_to_mathml(**options)
 *         name = self._head.get_name()             # <<<<<<<<<<<<<<
 *         if (
 *             name == "System`RowBox"
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_name = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1537
 *         name = self._head.get_name()
 *         if (
 *             name == "System`RowBox"             # <<<<<<<<<<<<<<
 *             and len(self._leaves) == 1
 *             and self._leaves[0].get_head_name() == "System`List"  # nopep8
 */
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_RowBox, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1537, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L7_bool_binop_done;
  }

  /* "mathics/core/expression.py":1538
 *         if (
 *             name == "System`RowBox"
 *             and len(self._leaves) == 1             # <<<<<<<<<<<<<<
 *             and self._leaves[0].get_head_name() == "System`List"  # nopep8
 *         ):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1538, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = ((__pyx_t_8 == 1) != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L7_bool_binop_done;
  }

  /* "mathics/core/expression.py":1539
 *             name == "System`RowBox"
 *             and len(self._leaves) == 1
 *             and self._leaves[0].get_head_name() == "System`List"  # nopep8             # <<<<<<<<<<<<<<
 *         ):
 *             result = []
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_List, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1539, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __pyx_t_7;
  __pyx_L7_bool_binop_done:;

  /* "mathics/core/expression.py":1536
 *             return self._leaves[0].boxes_to_mathml(**options)
 *         name = self._head.get_name()
 *         if (             # <<<<<<<<<<<<<<
 *             name == "System`RowBox"
 *             and len(self._leaves) == 1
 */
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1541
 *             and self._leaves[0].get_head_name() == "System`List"  # nopep8
 *         ):
 *             result = []             # <<<<<<<<<<<<<<
 *             inside_row = options.get("inside_row")
 *             # inside_list = options.get('inside_list')
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_result = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1542
 *         ):
 *             result = []
 *             inside_row = options.get("inside_row")             # <<<<<<<<<<<<<<
 *             # inside_list = options.get('inside_list')
 *             options = options.copy()
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_n_u_inside_row) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_u_inside_row);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_inside_row = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1544
 *             inside_row = options.get("inside_row")
 *             # inside_list = options.get('inside_list')
 *             options = options.copy()             # <<<<<<<<<<<<<<
 * 
 *             def is_list_interior(content):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1544, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1546
 *             options = options.copy()
 * 
 *             def is_list_interior(content):             # <<<<<<<<<<<<<<
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_15boxes_to_mathml_1is_list_interior, 0, __pyx_n_s_Expression_boxes_to_mathml_local_2, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_is_list_interior = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1553
 *                 return False
 * 
 *             is_list_row = False             # <<<<<<<<<<<<<<
 *             if (
 *                 len(self._leaves[0]._leaves) == 3
 */
    __pyx_v_is_list_row = 0;

    /* "mathics/core/expression.py":1555
 *             is_list_row = False
 *             if (
 *                 len(self._leaves[0]._leaves) == 3             # <<<<<<<<<<<<<<
 *                 and self._leaves[0]._leaves[0].get_string_value() == "{"  # nopep8
 *                 and self._leaves[0]._leaves[2].get_string_value() == "}"
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1555, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = ((__pyx_t_8 == 3) != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L11_bool_binop_done;
    }

    /* "mathics/core/expression.py":1556
 *             if (
 *                 len(self._leaves[0]._leaves) == 3
 *                 and self._leaves[0]._leaves[0].get_string_value() == "{"  # nopep8             # <<<<<<<<<<<<<<
 *                 and self._leaves[0]._leaves[2].get_string_value() == "}"
 *                 and self._leaves[0]._leaves[1].has_form("RowBox", 1)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_string_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u__51, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1556, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L11_bool_binop_done;
    }

    /* "mathics/core/expression.py":1557
 *                 len(self._leaves[0]._leaves) == 3
 *                 and self._leaves[0]._leaves[0].get_string_value() == "{"  # nopep8
 *                 and self._leaves[0]._leaves[2].get_string_value() == "}"             # <<<<<<<<<<<<<<
 *                 and self._leaves[0]._leaves[1].has_form("RowBox", 1)
 *             ):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_string_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u__52, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1557, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L11_bool_binop_done;
    }

    /* "mathics/core/expression.py":1558
 *                 and self._leaves[0]._leaves[0].get_string_value() == "{"  # nopep8
 *                 and self._leaves[0]._leaves[2].get_string_value() == "}"
 *                 and self._leaves[0]._leaves[1].has_form("RowBox", 1)             # <<<<<<<<<<<<<<
 *             ):
 *                 content = self._leaves[0]._leaves[1]._leaves[0]
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_has_form); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1558, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __pyx_t_7;
    __pyx_L11_bool_binop_done:;

    /* "mathics/core/expression.py":1554
 * 
 *             is_list_row = False
 *             if (             # <<<<<<<<<<<<<<
 *                 len(self._leaves[0]._leaves) == 3
 *                 and self._leaves[0]._leaves[0].get_string_value() == "{"  # nopep8
 */
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1560
 *                 and self._leaves[0]._leaves[1].has_form("RowBox", 1)
 *             ):
 *                 content = self._leaves[0]._leaves[1]._leaves[0]             # <<<<<<<<<<<<<<
 *                 if is_list_interior(content):
 *                     is_list_row = True
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1560, __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_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1560, __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_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_content = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1561
 *             ):
 *                 content = self._leaves[0]._leaves[1]._leaves[0]
 *                 if is_list_interior(content):             # <<<<<<<<<<<<<<
 *                     is_list_row = True
 * 
 */
      __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_15boxes_to_mathml_is_list_interior(__pyx_v_is_list_interior, __pyx_v_content); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1561, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1561, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":1562
 *                 content = self._leaves[0]._leaves[1]._leaves[0]
 *                 if is_list_interior(content):
 *                     is_list_row = True             # <<<<<<<<<<<<<<
 * 
 *             if not inside_row and is_list_interior(self._leaves[0]):
 */
        __pyx_v_is_list_row = 1;

        /* "mathics/core/expression.py":1561
 *             ):
 *                 content = self._leaves[0]._leaves[1]._leaves[0]
 *                 if is_list_interior(content):             # <<<<<<<<<<<<<<
 *                     is_list_row = True
 * 
 */
      }

      /* "mathics/core/expression.py":1554
 * 
 *             is_list_row = False
 *             if (             # <<<<<<<<<<<<<<
 *                 len(self._leaves[0]._leaves) == 3
 *                 and self._leaves[0]._leaves[0].get_string_value() == "{"  # nopep8
 */
    }

    /* "mathics/core/expression.py":1564
 *                     is_list_row = True
 * 
 *             if not inside_row and is_list_interior(self._leaves[0]):             # <<<<<<<<<<<<<<
 *                 is_list_row = True
 * 
 */
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_inside_row); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1564, __pyx_L1_error)
    __pyx_t_9 = ((!__pyx_t_7) != 0);
    if (__pyx_t_9) {
    } else {
      __pyx_t_6 = __pyx_t_9;
      goto __pyx_L17_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_15boxes_to_mathml_is_list_interior(__pyx_v_is_list_interior, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1564, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __pyx_t_9;
    __pyx_L17_bool_binop_done:;
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1565
 * 
 *             if not inside_row and is_list_interior(self._leaves[0]):
 *                 is_list_row = True             # <<<<<<<<<<<<<<
 * 
 *             if is_list_row:
 */
      __pyx_v_is_list_row = 1;

      /* "mathics/core/expression.py":1564
 *                     is_list_row = True
 * 
 *             if not inside_row and is_list_interior(self._leaves[0]):             # <<<<<<<<<<<<<<
 *                 is_list_row = True
 * 
 */
    }

    /* "mathics/core/expression.py":1567
 *                 is_list_row = True
 * 
 *             if is_list_row:             # <<<<<<<<<<<<<<
 *                 options["inside_list"] = True
 *             else:
 */
    __pyx_t_6 = (__pyx_v_is_list_row != 0);
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1568
 * 
 *             if is_list_row:
 *                 options["inside_list"] = True             # <<<<<<<<<<<<<<
 *             else:
 *                 options["inside_row"] = True
 */
      if (unlikely(PyObject_SetItem(__pyx_v_options, __pyx_n_u_inside_list, Py_True) < 0)) __PYX_ERR(0, 1568, __pyx_L1_error)

      /* "mathics/core/expression.py":1567
 *                 is_list_row = True
 * 
 *             if is_list_row:             # <<<<<<<<<<<<<<
 *                 options["inside_list"] = True
 *             else:
 */
      goto __pyx_L19;
    }

    /* "mathics/core/expression.py":1570
 *                 options["inside_list"] = True
 *             else:
 *                 options["inside_row"] = True             # <<<<<<<<<<<<<<
 * 
 *             for leaf in self._leaves[0].get_leaves():
 */
    /*else*/ {
      if (unlikely(PyObject_SetItem(__pyx_v_options, __pyx_n_u_inside_row, Py_True) < 0)) __PYX_ERR(0, 1570, __pyx_L1_error)
    }
    __pyx_L19:;

    /* "mathics/core/expression.py":1572
 *                 options["inside_row"] = True
 * 
 *             for leaf in self._leaves[0].get_leaves():             # <<<<<<<<<<<<<<
 *                 result.append(leaf.boxes_to_mathml(**options))
 *             return "<mrow>%s</mrow>" % " ".join(result)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1572, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1572, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1572, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1572, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1572, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_10(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1572, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1573
 * 
 *             for leaf in self._leaves[0].get_leaves():
 *                 result.append(leaf.boxes_to_mathml(**options))             # <<<<<<<<<<<<<<
 *             return "<mrow>%s</mrow>" % " ".join(result)
 *         else:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1573, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_3 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1573, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1573, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 1573, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "mathics/core/expression.py":1572
 *                 options["inside_row"] = True
 * 
 *             for leaf in self._leaves[0].get_leaves():             # <<<<<<<<<<<<<<
 *                 result.append(leaf.boxes_to_mathml(**options))
 *             return "<mrow>%s</mrow>" % " ".join(result)
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1574
 *             for leaf in self._leaves[0].get_leaves():
 *                 result.append(leaf.boxes_to_mathml(**options))
 *             return "<mrow>%s</mrow>" % " ".join(result)             # <<<<<<<<<<<<<<
 *         else:
 *             options = options.copy()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__53, __pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_mrow_s_mrow, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1536
 *             return self._leaves[0].boxes_to_mathml(**options)
 *         name = self._head.get_name()
 *         if (             # <<<<<<<<<<<<<<
 *             name == "System`RowBox"
 *             and len(self._leaves) == 1
 */
  }

  /* "mathics/core/expression.py":1576
 *             return "<mrow>%s</mrow>" % " ".join(result)
 *         else:
 *             options = options.copy()             # <<<<<<<<<<<<<<
 *             options["inside_row"] = True
 *             if name == "System`SuperscriptBox" and len(self._leaves) == 2:
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1577
 *         else:
 *             options = options.copy()
 *             options["inside_row"] = True             # <<<<<<<<<<<<<<
 *             if name == "System`SuperscriptBox" and len(self._leaves) == 2:
 *                 return "<msup>%s %s</msup>" % (
 */
    if (unlikely(PyObject_SetItem(__pyx_v_options, __pyx_n_u_inside_row, Py_True) < 0)) __PYX_ERR(0, 1577, __pyx_L1_error)

    /* "mathics/core/expression.py":1578
 *             options = options.copy()
 *             options["inside_row"] = True
 *             if name == "System`SuperscriptBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *                 return "<msup>%s %s</msup>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 */
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_SuperscriptBox, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1578, __pyx_L1_error)
    if (__pyx_t_9) {
    } else {
      __pyx_t_6 = __pyx_t_9;
      goto __pyx_L23_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1578, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = ((__pyx_t_8 == 2) != 0);
    __pyx_t_6 = __pyx_t_9;
    __pyx_L23_bool_binop_done:;
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1579
 *             options["inside_row"] = True
 *             if name == "System`SuperscriptBox" and len(self._leaves) == 2:
 *                 return "<msup>%s %s</msup>" % (             # <<<<<<<<<<<<<<
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = 0;
      __pyx_t_12 = 127;
      __Pyx_INCREF(__pyx_kp_u_msup);
      __pyx_t_8 += 6;
      __Pyx_GIVEREF(__pyx_kp_u_msup);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_msup);

      /* "mathics/core/expression.py":1580
 *             if name == "System`SuperscriptBox" and len(self._leaves) == 2:
 *                 return "<msup>%s %s</msup>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),             # <<<<<<<<<<<<<<
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                 )
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1580, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_3 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1580, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1580, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1580, __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_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_12;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_INCREF(__pyx_kp_u__53);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__53);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u__53);

      /* "mathics/core/expression.py":1581
 *                 return "<msup>%s %s</msup>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),             # <<<<<<<<<<<<<<
 *                 )
 *             if name == "System`SubscriptBox" and len(self._leaves) == 2:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1581, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_1), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_12;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_kp_u_msup_2);
      __pyx_t_8 += 7;
      __Pyx_GIVEREF(__pyx_kp_u_msup_2);
      PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u_msup_2);

      /* "mathics/core/expression.py":1579
 *             options["inside_row"] = True
 *             if name == "System`SuperscriptBox" and len(self._leaves) == 2:
 *                 return "<msup>%s %s</msup>" % (             # <<<<<<<<<<<<<<
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),
 */
      __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1578
 *             options = options.copy()
 *             options["inside_row"] = True
 *             if name == "System`SuperscriptBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *                 return "<msup>%s %s</msup>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 */
    }

    /* "mathics/core/expression.py":1583
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                 )
 *             if name == "System`SubscriptBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *                 return "<msub>%s %s</msub>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 */
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_SubscriptBox, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1583, __pyx_L1_error)
    if (__pyx_t_9) {
    } else {
      __pyx_t_6 = __pyx_t_9;
      goto __pyx_L26_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = ((__pyx_t_8 == 2) != 0);
    __pyx_t_6 = __pyx_t_9;
    __pyx_L26_bool_binop_done:;
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1584
 *                 )
 *             if name == "System`SubscriptBox" and len(self._leaves) == 2:
 *                 return "<msub>%s %s</msub>" % (             # <<<<<<<<<<<<<<
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = 0;
      __pyx_t_12 = 127;
      __Pyx_INCREF(__pyx_kp_u_msub);
      __pyx_t_8 += 6;
      __Pyx_GIVEREF(__pyx_kp_u_msub);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_msub);

      /* "mathics/core/expression.py":1585
 *             if name == "System`SubscriptBox" and len(self._leaves) == 2:
 *                 return "<msub>%s %s</msub>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),             # <<<<<<<<<<<<<<
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                 )
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1585, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_1 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1585, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1585, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_3), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_12;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_INCREF(__pyx_kp_u__53);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__53);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__53);

      /* "mathics/core/expression.py":1586
 *                 return "<msub>%s %s</msub>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),             # <<<<<<<<<<<<<<
 *                 )
 *             if name == "System`SubsuperscriptBox" and len(self._leaves) == 3:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1586, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_3 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_12;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_INCREF(__pyx_kp_u_msub_2);
      __pyx_t_8 += 7;
      __Pyx_GIVEREF(__pyx_kp_u_msub_2);
      PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u_msub_2);

      /* "mathics/core/expression.py":1584
 *                 )
 *             if name == "System`SubscriptBox" and len(self._leaves) == 2:
 *                 return "<msub>%s %s</msub>" % (             # <<<<<<<<<<<<<<
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),
 */
      __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1583
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                 )
 *             if name == "System`SubscriptBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *                 return "<msub>%s %s</msub>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 */
    }

    /* "mathics/core/expression.py":1588
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                 )
 *             if name == "System`SubsuperscriptBox" and len(self._leaves) == 3:             # <<<<<<<<<<<<<<
 *                 return "<msubsup>%s %s %s</msubsup>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 */
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_SubsuperscriptBox, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1588, __pyx_L1_error)
    if (__pyx_t_9) {
    } else {
      __pyx_t_6 = __pyx_t_9;
      goto __pyx_L29_bool_binop_done;
    }
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1588, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = ((__pyx_t_8 == 3) != 0);
    __pyx_t_6 = __pyx_t_9;
    __pyx_L29_bool_binop_done:;
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1589
 *                 )
 *             if name == "System`SubsuperscriptBox" and len(self._leaves) == 3:
 *                 return "<msubsup>%s %s %s</msubsup>" % (             # <<<<<<<<<<<<<<
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyTuple_New(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1589, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = 0;
      __pyx_t_12 = 127;
      __Pyx_INCREF(__pyx_kp_u_msubsup);
      __pyx_t_8 += 9;
      __Pyx_GIVEREF(__pyx_kp_u_msubsup);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_msubsup);

      /* "mathics/core/expression.py":1590
 *             if name == "System`SubsuperscriptBox" and len(self._leaves) == 3:
 *                 return "<msubsup>%s %s %s</msubsup>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),             # <<<<<<<<<<<<<<
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                     self._leaves[2].boxes_to_mathml(**options),
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1590, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_4 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1590, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1590, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_1), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_12;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u__53);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__53);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__53);

      /* "mathics/core/expression.py":1591
 *                 return "<msubsup>%s %s %s</msubsup>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),             # <<<<<<<<<<<<<<
 *                     self._leaves[2].boxes_to_mathml(**options),
 *                 )
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1591, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1591, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1591, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1591, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_1 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1591, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1591, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1591, __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_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1591, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_12;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_INCREF(__pyx_kp_u__53);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__53);
      PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u__53);

      /* "mathics/core/expression.py":1592
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                     self._leaves[2].boxes_to_mathml(**options),             # <<<<<<<<<<<<<<
 *                 )
 *             elif name == "System`FractionBox" and len(self._leaves) == 2:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1592, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1592, __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_boxes_to_mathml); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1592, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1592, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1592, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1592, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_12;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 5, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_kp_u_msubsup_2);
      __pyx_t_8 += 10;
      __Pyx_GIVEREF(__pyx_kp_u_msubsup_2);
      PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_kp_u_msubsup_2);

      /* "mathics/core/expression.py":1589
 *                 )
 *             if name == "System`SubsuperscriptBox" and len(self._leaves) == 3:
 *                 return "<msubsup>%s %s %s</msubsup>" % (             # <<<<<<<<<<<<<<
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),
 */
      __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 7, __pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1589, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1588
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                 )
 *             if name == "System`SubsuperscriptBox" and len(self._leaves) == 3:             # <<<<<<<<<<<<<<
 *                 return "<msubsup>%s %s %s</msubsup>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 */
    }

    /* "mathics/core/expression.py":1594
 *                     self._leaves[2].boxes_to_mathml(**options),
 *                 )
 *             elif name == "System`FractionBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *                 return "<mfrac>%s %s</mfrac>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 */
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_FractionBox, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1594, __pyx_L1_error)
    if (__pyx_t_9) {
    } else {
      __pyx_t_6 = __pyx_t_9;
      goto __pyx_L31_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1594, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = ((__pyx_t_8 == 2) != 0);
    __pyx_t_6 = __pyx_t_9;
    __pyx_L31_bool_binop_done:;
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1595
 *                 )
 *             elif name == "System`FractionBox" and len(self._leaves) == 2:
 *                 return "<mfrac>%s %s</mfrac>" % (             # <<<<<<<<<<<<<<
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1595, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = 0;
      __pyx_t_12 = 127;
      __Pyx_INCREF(__pyx_kp_u_mfrac);
      __pyx_t_8 += 7;
      __Pyx_GIVEREF(__pyx_kp_u_mfrac);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_mfrac);

      /* "mathics/core/expression.py":1596
 *             elif name == "System`FractionBox" and len(self._leaves) == 2:
 *                 return "<mfrac>%s %s</mfrac>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),             # <<<<<<<<<<<<<<
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                 )
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1596, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1596, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1596, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1596, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_4 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1596, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1596, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1596, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_1), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1596, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_12;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u__53);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__53);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u__53);

      /* "mathics/core/expression.py":1597
 *                 return "<mfrac>%s %s</mfrac>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),             # <<<<<<<<<<<<<<
 *                 )
 *             elif name == "System`SqrtBox" and len(self._leaves) == 1:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1597, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_1 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_1 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_3), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_12 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_12) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_12;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_INCREF(__pyx_kp_u_mfrac_2);
      __pyx_t_8 += 8;
      __Pyx_GIVEREF(__pyx_kp_u_mfrac_2);
      PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u_mfrac_2);

      /* "mathics/core/expression.py":1595
 *                 )
 *             elif name == "System`FractionBox" and len(self._leaves) == 2:
 *                 return "<mfrac>%s %s</mfrac>" % (             # <<<<<<<<<<<<<<
 *                     self._leaves[0].boxes_to_mathml(**options),
 *                     self._leaves[1].boxes_to_mathml(**options),
 */
      __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1595, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1594
 *                     self._leaves[2].boxes_to_mathml(**options),
 *                 )
 *             elif name == "System`FractionBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *                 return "<mfrac>%s %s</mfrac>" % (
 *                     self._leaves[0].boxes_to_mathml(**options),
 */
    }

    /* "mathics/core/expression.py":1599
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                 )
 *             elif name == "System`SqrtBox" and len(self._leaves) == 1:             # <<<<<<<<<<<<<<
 *                 return "<msqrt>%s</msqrt>" % (
 *                     self._leaves[0].boxes_to_mathml(**options)
 */
    __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_SqrtBox, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1599, __pyx_L1_error)
    if (__pyx_t_9) {
    } else {
      __pyx_t_6 = __pyx_t_9;
      goto __pyx_L33_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1599, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1599, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = ((__pyx_t_8 == 1) != 0);
    __pyx_t_6 = __pyx_t_9;
    __pyx_L33_bool_binop_done:;
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1600
 *                 )
 *             elif name == "System`SqrtBox" and len(self._leaves) == 1:
 *                 return "<msqrt>%s</msqrt>" % (             # <<<<<<<<<<<<<<
 *                     self._leaves[0].boxes_to_mathml(**options)
 *                 )
 */
      __Pyx_XDECREF(__pyx_r);

      /* "mathics/core/expression.py":1601
 *             elif name == "System`SqrtBox" and len(self._leaves) == 1:
 *                 return "<msqrt>%s</msqrt>" % (
 *                     self._leaves[0].boxes_to_mathml(**options)             # <<<<<<<<<<<<<<
 *                 )
 *             elif name == "System`GraphBox":
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1601, __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_boxes_to_mathml); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1601, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1601, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1601, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1601, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1601, __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;

      /* "mathics/core/expression.py":1600
 *                 )
 *             elif name == "System`SqrtBox" and len(self._leaves) == 1:
 *                 return "<msqrt>%s</msqrt>" % (             # <<<<<<<<<<<<<<
 *                     self._leaves[0].boxes_to_mathml(**options)
 *                 )
 */
      __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_msqrt_s_msqrt, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1599
 *                     self._leaves[1].boxes_to_mathml(**options),
 *                 )
 *             elif name == "System`SqrtBox" and len(self._leaves) == 1:             # <<<<<<<<<<<<<<
 *                 return "<msqrt>%s</msqrt>" % (
 *                     self._leaves[0].boxes_to_mathml(**options)
 */
    }

    /* "mathics/core/expression.py":1603
 *                     self._leaves[0].boxes_to_mathml(**options)
 *                 )
 *             elif name == "System`GraphBox":             # <<<<<<<<<<<<<<
 *                 return "<mi>%s</mi>" % (self._leaves[0].boxes_to_mathml(**options))
 *             else:
 */
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_GraphBox, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1603, __pyx_L1_error)
    if (likely(__pyx_t_6)) {

      /* "mathics/core/expression.py":1604
 *                 )
 *             elif name == "System`GraphBox":
 *                 return "<mi>%s</mi>" % (self._leaves[0].boxes_to_mathml(**options))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise BoxError(self, "xml")
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1604, __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_boxes_to_mathml); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1604, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_3 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1604, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1604, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_mi_s_mi, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1603
 *                     self._leaves[0].boxes_to_mathml(**options)
 *                 )
 *             elif name == "System`GraphBox":             # <<<<<<<<<<<<<<
 *                 return "<mi>%s</mi>" % (self._leaves[0].boxes_to_mathml(**options))
 *             else:
 */
    }

    /* "mathics/core/expression.py":1606
 *                 return "<mi>%s</mi>" % (self._leaves[0].boxes_to_mathml(**options))
 *             else:
 *                 raise BoxError(self, "xml")             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_tex(self, **options) -> str:
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BoxError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1606, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = NULL;
      __pyx_t_13 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_13 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self, __pyx_n_u_xml};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1606, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_self, __pyx_n_u_xml};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1606, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1606, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(__pyx_v_self);
        __Pyx_GIVEREF(__pyx_v_self);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_13, __pyx_v_self);
        __Pyx_INCREF(__pyx_n_u_xml);
        __Pyx_GIVEREF(__pyx_n_u_xml);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_13, __pyx_n_u_xml);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1606, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 1606, __pyx_L1_error)
    }
  }

  /* "mathics/core/expression.py":1531
 *             raise BoxError(self, "text")
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 */

  /* 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("mathics.core.expression.Expression.boxes_to_mathml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_options);
  __Pyx_XDECREF(__pyx_v_is_style);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_inside_row);
  __Pyx_XDECREF(__pyx_v_is_list_interior);
  __Pyx_XDECREF(__pyx_v_content);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1608
 *                 raise BoxError(self, "xml")
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         def block(tex, only_subsup=False):
 *             if len(tex) == 1:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_91boxes_to_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_91boxes_to_tex = {"boxes_to_tex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_91boxes_to_tex, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_91boxes_to_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_tex (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_tex") < 0)) __PYX_ERR(0, 1608, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_tex", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1608, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.Expression.boxes_to_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_90boxes_to_tex(__pyx_self, __pyx_v_self, __pyx_v_options);

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

/* "mathics/core/expression.py":1609
 * 
 *     def boxes_to_tex(self, **options) -> str:
 *         def block(tex, only_subsup=False):             # <<<<<<<<<<<<<<
 *             if len(tex) == 1:
 *                 return tex
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_12boxes_to_tex_1block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_12boxes_to_tex_1block = {"block", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_12boxes_to_tex_1block, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_12boxes_to_tex_1block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tex = 0;
  PyObject *__pyx_v_only_subsup = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("block (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tex,&__pyx_n_s_only_subsup,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tex)) != 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_only_subsup);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "block") < 0)) __PYX_ERR(0, 1609, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tex = values[0];
    __pyx_v_only_subsup = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("block", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1609, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.boxes_to_tex.block", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_12boxes_to_tex_block(__pyx_self, __pyx_v_tex, __pyx_v_only_subsup);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_12boxes_to_tex_block(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_tex, PyObject *__pyx_v_only_subsup) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("block", 0);

  /* "mathics/core/expression.py":1610
 *     def boxes_to_tex(self, **options) -> str:
 *         def block(tex, only_subsup=False):
 *             if len(tex) == 1:             # <<<<<<<<<<<<<<
 *                 return tex
 *             else:
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_tex); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1610, __pyx_L1_error)
  __pyx_t_2 = ((__pyx_t_1 == 1) != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":1611
 *         def block(tex, only_subsup=False):
 *             if len(tex) == 1:
 *                 return tex             # <<<<<<<<<<<<<<
 *             else:
 *                 if not only_subsup or "_" in tex or "^" in tex:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_tex);
    __pyx_r = __pyx_v_tex;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1610
 *     def boxes_to_tex(self, **options) -> str:
 *         def block(tex, only_subsup=False):
 *             if len(tex) == 1:             # <<<<<<<<<<<<<<
 *                 return tex
 *             else:
 */
  }

  /* "mathics/core/expression.py":1613
 *                 return tex
 *             else:
 *                 if not only_subsup or "_" in tex or "^" in tex:             # <<<<<<<<<<<<<<
 *                     return "{%s}" % tex
 *                 else:
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_only_subsup); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __pyx_t_4 = ((!__pyx_t_3) != 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_n_u__54, __pyx_v_tex, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__42, __pyx_v_tex, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __pyx_t_4 = (__pyx_t_3 != 0);
    __pyx_t_2 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_2) {

      /* "mathics/core/expression.py":1614
 *             else:
 *                 if not only_subsup or "_" in tex or "^" in tex:
 *                     return "{%s}" % tex             # <<<<<<<<<<<<<<
 *                 else:
 *                     return tex
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s, __pyx_v_tex); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1613
 *                 return tex
 *             else:
 *                 if not only_subsup or "_" in tex or "^" in tex:             # <<<<<<<<<<<<<<
 *                     return "{%s}" % tex
 *                 else:
 */
    }

    /* "mathics/core/expression.py":1616
 *                     return "{%s}" % tex
 *                 else:
 *                     return tex             # <<<<<<<<<<<<<<
 * 
 *         is_style, options = self.process_style_box(options)
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_tex);
      __pyx_r = __pyx_v_tex;
      goto __pyx_L0;
    }
  }

  /* "mathics/core/expression.py":1609
 * 
 *     def boxes_to_tex(self, **options) -> str:
 *         def block(tex, only_subsup=False):             # <<<<<<<<<<<<<<
 *             if len(tex) == 1:
 *                 return tex
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Expression.boxes_to_tex.block", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1608
 *                 raise BoxError(self, "xml")
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         def block(tex, only_subsup=False):
 *             if len(tex) == 1:
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_90boxes_to_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options) {
  PyObject *__pyx_v_block = 0;
  PyObject *__pyx_v_is_style = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_tex1 = NULL;
  PyObject *__pyx_v_sup_string = NULL;
  PyObject *__pyx_9genexpr25__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  Py_UCS4 __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("boxes_to_tex", 0);
  __Pyx_INCREF(__pyx_v_options);

  /* "mathics/core/expression.py":1609
 * 
 *     def boxes_to_tex(self, **options) -> str:
 *         def block(tex, only_subsup=False):             # <<<<<<<<<<<<<<
 *             if len(tex) == 1:
 *                 return tex
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_12boxes_to_tex_1block, 0, __pyx_n_s_Expression_boxes_to_tex_locals_b, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__57);
  __pyx_v_block = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1618
 *                     return tex
 * 
 *         is_style, options = self.process_style_box(options)             # <<<<<<<<<<<<<<
 *         if is_style:
 *             return self._leaves[0].boxes_to_tex(**options)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_process_style_box); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1618, __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_options) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_options);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1618, __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, 1618, __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, 1618, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1618, __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, 1618, __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, 1618, __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, 1618, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_is_style = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_options, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "mathics/core/expression.py":1619
 * 
 *         is_style, options = self.process_style_box(options)
 *         if is_style:             # <<<<<<<<<<<<<<
 *             return self._leaves[0].boxes_to_tex(**options)
 *         name = self._head.get_name()
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_is_style); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1619, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1620
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 *             return self._leaves[0].boxes_to_tex(**options)             # <<<<<<<<<<<<<<
 *         name = self._head.get_name()
 *         if (
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1620, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_3 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1620, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1620, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1620, __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 (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1620, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1619
 * 
 *         is_style, options = self.process_style_box(options)
 *         if is_style:             # <<<<<<<<<<<<<<
 *             return self._leaves[0].boxes_to_tex(**options)
 *         name = self._head.get_name()
 */
  }

  /* "mathics/core/expression.py":1621
 *         if is_style:
 *             return self._leaves[0].boxes_to_tex(**options)
 *         name = self._head.get_name()             # <<<<<<<<<<<<<<
 *         if (
 *             name == "System`RowBox"
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_name = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1623
 *         name = self._head.get_name()
 *         if (
 *             name == "System`RowBox"             # <<<<<<<<<<<<<<
 *             and len(self._leaves) == 1
 *             and self._leaves[0].get_head_name() == "System`List"  # nopep8
 */
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_RowBox, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1623, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L7_bool_binop_done;
  }

  /* "mathics/core/expression.py":1624
 *         if (
 *             name == "System`RowBox"
 *             and len(self._leaves) == 1             # <<<<<<<<<<<<<<
 *             and self._leaves[0].get_head_name() == "System`List"  # nopep8
 *         ):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1624, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = ((__pyx_t_8 == 1) != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L7_bool_binop_done;
  }

  /* "mathics/core/expression.py":1625
 *             name == "System`RowBox"
 *             and len(self._leaves) == 1
 *             and self._leaves[0].get_head_name() == "System`List"  # nopep8             # <<<<<<<<<<<<<<
 *         ):
 *             return "".join(
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_List, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __pyx_t_7;
  __pyx_L7_bool_binop_done:;

  /* "mathics/core/expression.py":1622
 *             return self._leaves[0].boxes_to_tex(**options)
 *         name = self._head.get_name()
 *         if (             # <<<<<<<<<<<<<<
 *             name == "System`RowBox"
 *             and len(self._leaves) == 1
 */
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1627
 *             and self._leaves[0].get_head_name() == "System`List"  # nopep8
 *         ):
 *             return "".join(             # <<<<<<<<<<<<<<
 *                 [leaf.boxes_to_tex(**options) for leaf in self._leaves[0].get_leaves()]
 *             )
 */
    __Pyx_XDECREF(__pyx_r);
    { /* enter inner scope */

      /* "mathics/core/expression.py":1628
 *         ):
 *             return "".join(
 *                 [leaf.boxes_to_tex(**options) for leaf in self._leaves[0].get_leaves()]             # <<<<<<<<<<<<<<
 *             )
 *         elif name == "System`SuperscriptBox" and len(self._leaves) == 2:
 */
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1628, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1628, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1628, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_leaves); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1628, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_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_1)) __PYX_ERR(0, 1628, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
        __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
      } else {
        __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1628, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1628, __pyx_L12_error)
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      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_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1628, __pyx_L12_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1628, __pyx_L12_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          } else {
            if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1628, __pyx_L12_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1628, __pyx_L12_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          }
        } else {
          __pyx_t_1 = __pyx_t_9(__pyx_t_3);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1628, __pyx_L12_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr25__pyx_v_leaf, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr25__pyx_v_leaf, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1628, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (unlikely(__pyx_v_options == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
          __PYX_ERR(0, 1628, __pyx_L12_error)
        }
        if (likely(PyDict_CheckExact(__pyx_v_options))) {
          __pyx_t_4 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1628, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_4);
        } else {
          __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1628, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1628, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 1628, __pyx_L12_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_leaf); __pyx_9genexpr25__pyx_v_leaf = 0;
      goto __pyx_L15_exit_scope;
      __pyx_L12_error:;
      __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_leaf); __pyx_9genexpr25__pyx_v_leaf = 0;
      goto __pyx_L1_error;
      __pyx_L15_exit_scope:;
    } /* exit inner scope */

    /* "mathics/core/expression.py":1627
 *             and self._leaves[0].get_head_name() == "System`List"  # nopep8
 *         ):
 *             return "".join(             # <<<<<<<<<<<<<<
 *                 [leaf.boxes_to_tex(**options) for leaf in self._leaves[0].get_leaves()]
 *             )
 */
    __pyx_t_3 = PyUnicode_Join(__pyx_kp_u__3, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1627, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1622
 *             return self._leaves[0].boxes_to_tex(**options)
 *         name = self._head.get_name()
 *         if (             # <<<<<<<<<<<<<<
 *             name == "System`RowBox"
 *             and len(self._leaves) == 1
 */
  }

  /* "mathics/core/expression.py":1630
 *                 [leaf.boxes_to_tex(**options) for leaf in self._leaves[0].get_leaves()]
 *             )
 *         elif name == "System`SuperscriptBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *             tex1 = self._leaves[0].boxes_to_tex(**options)
 *             sup_string = self._leaves[1].get_string_value()
 */
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_SuperscriptBox, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1630, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1630, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = ((__pyx_t_8 == 2) != 0);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L16_bool_binop_done:;
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1631
 *             )
 *         elif name == "System`SuperscriptBox" and len(self._leaves) == 2:
 *             tex1 = self._leaves[0].boxes_to_tex(**options)             # <<<<<<<<<<<<<<
 *             sup_string = self._leaves[1].get_string_value()
 *             if sup_string == "\u2032":
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1631, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1631, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1631, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1631, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_tex1 = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "mathics/core/expression.py":1632
 *         elif name == "System`SuperscriptBox" and len(self._leaves) == 2:
 *             tex1 = self._leaves[0].boxes_to_tex(**options)
 *             sup_string = self._leaves[1].get_string_value()             # <<<<<<<<<<<<<<
 *             if sup_string == "\u2032":
 *                 return "%s'" % tex1
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_string_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1632, __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_10 = (__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_10)) __PYX_ERR(0, 1632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_sup_string = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "mathics/core/expression.py":1633
 *             tex1 = self._leaves[0].boxes_to_tex(**options)
 *             sup_string = self._leaves[1].get_string_value()
 *             if sup_string == "\u2032":             # <<<<<<<<<<<<<<
 *                 return "%s'" % tex1
 *             elif sup_string == "\u2032\u2032":
 */
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_sup_string, __pyx_kp_u__58, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1633, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1634
 *             sup_string = self._leaves[1].get_string_value()
 *             if sup_string == "\u2032":
 *                 return "%s'" % tex1             # <<<<<<<<<<<<<<
 *             elif sup_string == "\u2032\u2032":
 *                 return "%s''" % tex1
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_10 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s_2, __pyx_v_tex1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_r = ((PyObject*)__pyx_t_10);
      __pyx_t_10 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1633
 *             tex1 = self._leaves[0].boxes_to_tex(**options)
 *             sup_string = self._leaves[1].get_string_value()
 *             if sup_string == "\u2032":             # <<<<<<<<<<<<<<
 *                 return "%s'" % tex1
 *             elif sup_string == "\u2032\u2032":
 */
    }

    /* "mathics/core/expression.py":1635
 *             if sup_string == "\u2032":
 *                 return "%s'" % tex1
 *             elif sup_string == "\u2032\u2032":             # <<<<<<<<<<<<<<
 *                 return "%s''" % tex1
 *             else:
 */
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_sup_string, __pyx_kp_u__59, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1635, __pyx_L1_error)
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1636
 *                 return "%s'" % tex1
 *             elif sup_string == "\u2032\u2032":
 *                 return "%s''" % tex1             # <<<<<<<<<<<<<<
 *             else:
 *                 return "%s^%s" % (
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_10 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s_3, __pyx_v_tex1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1636, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_r = ((PyObject*)__pyx_t_10);
      __pyx_t_10 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1635
 *             if sup_string == "\u2032":
 *                 return "%s'" % tex1
 *             elif sup_string == "\u2032\u2032":             # <<<<<<<<<<<<<<
 *                 return "%s''" % tex1
 *             else:
 */
    }

    /* "mathics/core/expression.py":1638
 *                 return "%s''" % tex1
 *             else:
 *                 return "%s^%s" % (             # <<<<<<<<<<<<<<
 *                     block(tex1, True),
 *                     block(self._leaves[1].boxes_to_tex(**options)),
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_8 = 0;
      __pyx_t_11 = 127;

      /* "mathics/core/expression.py":1639
 *             else:
 *                 return "%s^%s" % (
 *                     block(tex1, True),             # <<<<<<<<<<<<<<
 *                     block(self._leaves[1].boxes_to_tex(**options)),
 *                 )
 */
      __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_12boxes_to_tex_block(__pyx_v_block, __pyx_v_tex1, Py_True); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1639, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1639, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_11;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_INCREF(__pyx_kp_u__42);
      __pyx_t_8 += 1;
      __Pyx_GIVEREF(__pyx_kp_u__42);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_kp_u__42);

      /* "mathics/core/expression.py":1640
 *                 return "%s^%s" % (
 *                     block(tex1, True),
 *                     block(self._leaves[1].boxes_to_tex(**options)),             # <<<<<<<<<<<<<<
 *                 )
 *         elif name == "System`SubscriptBox" and len(self._leaves) == 2:
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(__pyx_v_options == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
        __PYX_ERR(0, 1640, __pyx_L1_error)
      }
      if (likely(PyDict_CheckExact(__pyx_v_options))) {
        __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1640, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1640, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_v_block, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
      __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "mathics/core/expression.py":1638
 *                 return "%s''" % tex1
 *             else:
 *                 return "%s^%s" % (             # <<<<<<<<<<<<<<
 *                     block(tex1, True),
 *                     block(self._leaves[1].boxes_to_tex(**options)),
 */
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, __pyx_t_8, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_r = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }

    /* "mathics/core/expression.py":1630
 *                 [leaf.boxes_to_tex(**options) for leaf in self._leaves[0].get_leaves()]
 *             )
 *         elif name == "System`SuperscriptBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *             tex1 = self._leaves[0].boxes_to_tex(**options)
 *             sup_string = self._leaves[1].get_string_value()
 */
  }

  /* "mathics/core/expression.py":1642
 *                     block(self._leaves[1].boxes_to_tex(**options)),
 *                 )
 *         elif name == "System`SubscriptBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *             return "%s_%s" % (
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 */
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_SubscriptBox, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1642, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L19_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = ((__pyx_t_8 == 2) != 0);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L19_bool_binop_done:;
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1643
 *                 )
 *         elif name == "System`SubscriptBox" and len(self._leaves) == 2:
 *             return "%s_%s" % (             # <<<<<<<<<<<<<<
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 *                 block(self._leaves[1].boxes_to_tex(**options)),
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = 0;
    __pyx_t_11 = 127;

    /* "mathics/core/expression.py":1644
 *         elif name == "System`SubscriptBox" and len(self._leaves) == 2:
 *             return "%s_%s" % (
 *                 block(self._leaves[0].boxes_to_tex(**options), True),             # <<<<<<<<<<<<<<
 *                 block(self._leaves[1].boxes_to_tex(**options)),
 *             )
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1644, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1644, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1644, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_12boxes_to_tex_block(__pyx_v_block, __pyx_t_3, Py_True); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1644, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_11;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_n_u__54);
    __pyx_t_8 += 1;
    __Pyx_GIVEREF(__pyx_n_u__54);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_u__54);

    /* "mathics/core/expression.py":1645
 *             return "%s_%s" % (
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 *                 block(self._leaves[1].boxes_to_tex(**options)),             # <<<<<<<<<<<<<<
 *             )
 *         elif name == "System`SubsuperscriptBox" and len(self._leaves) == 3:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1645, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1645, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1645, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_v_block, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1645, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_11;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "mathics/core/expression.py":1643
 *                 )
 *         elif name == "System`SubscriptBox" and len(self._leaves) == 2:
 *             return "%s_%s" % (             # <<<<<<<<<<<<<<
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 *                 block(self._leaves[1].boxes_to_tex(**options)),
 */
    __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_8, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = ((PyObject*)__pyx_t_10);
    __pyx_t_10 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1642
 *                     block(self._leaves[1].boxes_to_tex(**options)),
 *                 )
 *         elif name == "System`SubscriptBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *             return "%s_%s" % (
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 */
  }

  /* "mathics/core/expression.py":1647
 *                 block(self._leaves[1].boxes_to_tex(**options)),
 *             )
 *         elif name == "System`SubsuperscriptBox" and len(self._leaves) == 3:             # <<<<<<<<<<<<<<
 *             return "%s_%s^%s" % (
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 */
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_SubsuperscriptBox, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1647, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L21_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1647, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_7 = ((__pyx_t_8 == 3) != 0);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L21_bool_binop_done:;
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1648
 *             )
 *         elif name == "System`SubsuperscriptBox" and len(self._leaves) == 3:
 *             return "%s_%s^%s" % (             # <<<<<<<<<<<<<<
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 *                 block(self._leaves[1].boxes_to_tex(**options)),
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_10 = PyTuple_New(5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = 0;
    __pyx_t_11 = 127;

    /* "mathics/core/expression.py":1649
 *         elif name == "System`SubsuperscriptBox" and len(self._leaves) == 3:
 *             return "%s_%s^%s" % (
 *                 block(self._leaves[0].boxes_to_tex(**options), True),             # <<<<<<<<<<<<<<
 *                 block(self._leaves[1].boxes_to_tex(**options)),
 *                 block(self._leaves[2].boxes_to_tex(**options)),
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1649, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1649, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1649, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_12boxes_to_tex_block(__pyx_v_block, __pyx_t_3, Py_True); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_11;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_n_u__54);
    __pyx_t_8 += 1;
    __Pyx_GIVEREF(__pyx_n_u__54);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_n_u__54);

    /* "mathics/core/expression.py":1650
 *             return "%s_%s^%s" % (
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 *                 block(self._leaves[1].boxes_to_tex(**options)),             # <<<<<<<<<<<<<<
 *                 block(self._leaves[2].boxes_to_tex(**options)),
 *             )
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1650, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1650, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1650, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_v_block, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_INCREF(__pyx_kp_u__42);
    __pyx_t_8 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__42);
    PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_kp_u__42);

    /* "mathics/core/expression.py":1651
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 *                 block(self._leaves[1].boxes_to_tex(**options)),
 *                 block(self._leaves[2].boxes_to_tex(**options)),             # <<<<<<<<<<<<<<
 *             )
 *         elif name == "System`FractionBox" and len(self._leaves) == 2:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1651, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_v_block, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_2), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_11;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":1648
 *             )
 *         elif name == "System`SubsuperscriptBox" and len(self._leaves) == 3:
 *             return "%s_%s^%s" % (             # <<<<<<<<<<<<<<
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 *                 block(self._leaves[1].boxes_to_tex(**options)),
 */
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_10, 5, __pyx_t_8, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1648, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1647
 *                 block(self._leaves[1].boxes_to_tex(**options)),
 *             )
 *         elif name == "System`SubsuperscriptBox" and len(self._leaves) == 3:             # <<<<<<<<<<<<<<
 *             return "%s_%s^%s" % (
 *                 block(self._leaves[0].boxes_to_tex(**options), True),
 */
  }

  /* "mathics/core/expression.py":1653
 *                 block(self._leaves[2].boxes_to_tex(**options)),
 *             )
 *         elif name == "System`FractionBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *             return "\\frac{%s}{%s}" % (
 *                 self._leaves[0].boxes_to_tex(**options),
 */
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_FractionBox, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1653, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L23_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1653, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = ((__pyx_t_8 == 2) != 0);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L23_bool_binop_done:;
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1654
 *             )
 *         elif name == "System`FractionBox" and len(self._leaves) == 2:
 *             return "\\frac{%s}{%s}" % (             # <<<<<<<<<<<<<<
 *                 self._leaves[0].boxes_to_tex(**options),
 *                 self._leaves[1].boxes_to_tex(**options),
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = 0;
    __pyx_t_11 = 127;
    __Pyx_INCREF(__pyx_kp_u_frac);
    __pyx_t_8 += 6;
    __Pyx_GIVEREF(__pyx_kp_u_frac);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_frac);

    /* "mathics/core/expression.py":1655
 *         elif name == "System`FractionBox" and len(self._leaves) == 2:
 *             return "\\frac{%s}{%s}" % (
 *                 self._leaves[0].boxes_to_tex(**options),             # <<<<<<<<<<<<<<
 *                 self._leaves[1].boxes_to_tex(**options),
 *             )
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1655, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_2 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1655, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1655, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1655, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_11;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_kp_u__60);
    __pyx_t_8 += 2;
    __Pyx_GIVEREF(__pyx_kp_u__60);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__60);

    /* "mathics/core/expression.py":1656
 *             return "\\frac{%s}{%s}" % (
 *                 self._leaves[0].boxes_to_tex(**options),
 *                 self._leaves[1].boxes_to_tex(**options),             # <<<<<<<<<<<<<<
 *             )
 *         elif name == "System`SqrtBox" and len(self._leaves) == 1:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1656, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_4 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1656, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_4 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1656, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_10), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_11;
    __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_INCREF(__pyx_kp_u__52);
    __pyx_t_8 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__52);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u__52);

    /* "mathics/core/expression.py":1654
 *             )
 *         elif name == "System`FractionBox" and len(self._leaves) == 2:
 *             return "\\frac{%s}{%s}" % (             # <<<<<<<<<<<<<<
 *                 self._leaves[0].boxes_to_tex(**options),
 *                 self._leaves[1].boxes_to_tex(**options),
 */
    __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_8, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1653
 *                 block(self._leaves[2].boxes_to_tex(**options)),
 *             )
 *         elif name == "System`FractionBox" and len(self._leaves) == 2:             # <<<<<<<<<<<<<<
 *             return "\\frac{%s}{%s}" % (
 *                 self._leaves[0].boxes_to_tex(**options),
 */
  }

  /* "mathics/core/expression.py":1658
 *                 self._leaves[1].boxes_to_tex(**options),
 *             )
 *         elif name == "System`SqrtBox" and len(self._leaves) == 1:             # <<<<<<<<<<<<<<
 *             return "\\sqrt{%s}" % self._leaves[0].boxes_to_tex(**options)
 *         else:
 */
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u_System_SqrtBox, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1658, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L25_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1658, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = ((__pyx_t_8 == 1) != 0);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L25_bool_binop_done:;
  if (likely(__pyx_t_6)) {

    /* "mathics/core/expression.py":1659
 *             )
 *         elif name == "System`SqrtBox" and len(self._leaves) == 1:
 *             return "\\sqrt{%s}" % self._leaves[0].boxes_to_tex(**options)             # <<<<<<<<<<<<<<
 *         else:
 *             raise BoxError(self, "tex")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(__pyx_v_options == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
      __PYX_ERR(0, 1659, __pyx_L1_error)
    }
    if (likely(PyDict_CheckExact(__pyx_v_options))) {
      __pyx_t_3 = PyDict_Copy(__pyx_v_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_3 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_v_options, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    }
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_sqrt_s, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1658
 *                 self._leaves[1].boxes_to_tex(**options),
 *             )
 *         elif name == "System`SqrtBox" and len(self._leaves) == 1:             # <<<<<<<<<<<<<<
 *             return "\\sqrt{%s}" % self._leaves[0].boxes_to_tex(**options)
 *         else:
 */
  }

  /* "mathics/core/expression.py":1661
 *             return "\\sqrt{%s}" % self._leaves[0].boxes_to_tex(**options)
 *         else:
 *             raise BoxError(self, "tex")             # <<<<<<<<<<<<<<
 * 
 *     def default_format(self, evaluation, form) -> str:
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_BoxError); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = NULL;
    __pyx_t_12 = 0;
    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_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_self, __pyx_n_u_tex};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_self, __pyx_n_u_tex};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_12, __pyx_v_self);
      __Pyx_INCREF(__pyx_n_u_tex);
      __Pyx_GIVEREF(__pyx_n_u_tex);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_12, __pyx_n_u_tex);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __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, 1661, __pyx_L1_error)
  }

  /* "mathics/core/expression.py":1608
 *                 raise BoxError(self, "xml")
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         def block(tex, only_subsup=False):
 *             if len(tex) == 1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.Expression.boxes_to_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_options);
  __Pyx_XDECREF(__pyx_v_block);
  __Pyx_XDECREF(__pyx_v_is_style);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_tex1);
  __Pyx_XDECREF(__pyx_v_sup_string);
  __Pyx_XDECREF(__pyx_9genexpr25__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1663
 *             raise BoxError(self, "tex")
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[%s]" % (
 *             self._head.default_format(evaluation, form),
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_93default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_93default_format = {"default_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_93default_format, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_93default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 1); __PYX_ERR(0, 1663, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 2); __PYX_ERR(0, 1663, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_format") < 0)) __PYX_ERR(0, 1663, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1663, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_92default_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_92default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form) {
  PyObject *__pyx_9genexpr26__pyx_v_leaf = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("default_format", 0);

  /* "mathics/core/expression.py":1664
 * 
 *     def default_format(self, evaluation, form) -> str:
 *         return "%s[%s]" % (             # <<<<<<<<<<<<<<
 *             self._head.default_format(evaluation, form),
 *             ", ".join([leaf.default_format(evaluation, form) for leaf in self._leaves]),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;

  /* "mathics/core/expression.py":1665
 *     def default_format(self, evaluation, form) -> str:
 *         return "%s[%s]" % (
 *             self._head.default_format(evaluation, form),             # <<<<<<<<<<<<<<
 *             ", ".join([leaf.default_format(evaluation, form) for leaf in self._leaves]),
 *         )
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_default_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_evaluation, __pyx_v_form};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_evaluation, __pyx_v_form};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_evaluation);
    __Pyx_INCREF(__pyx_v_form);
    __Pyx_GIVEREF(__pyx_v_form);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_form);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1665, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_kp_u__33);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__33);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__33);

  /* "mathics/core/expression.py":1666
 *         return "%s[%s]" % (
 *             self._head.default_format(evaluation, form),
 *             ", ".join([leaf.default_format(evaluation, form) for leaf in self._leaves]),             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  { /* enter inner scope */
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1666, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1666, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_8 = __pyx_t_4; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1666, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1666, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_8))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1666, __pyx_L5_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1666, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1666, __pyx_L5_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1666, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_10(__pyx_t_8);
        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, 1666, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr26__pyx_v_leaf, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr26__pyx_v_leaf, __pyx_n_s_default_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1666, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_11);
          __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_11, __pyx_v_evaluation, __pyx_v_form};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1666, __pyx_L5_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_v_evaluation, __pyx_v_form};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1666, __pyx_L5_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1666, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_11) {
          __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
        }
        __Pyx_INCREF(__pyx_v_evaluation);
        __Pyx_GIVEREF(__pyx_v_evaluation);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_7, __pyx_v_evaluation);
        __Pyx_INCREF(__pyx_v_form);
        __Pyx_GIVEREF(__pyx_v_form);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_7, __pyx_v_form);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1666, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 1666, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_9genexpr26__pyx_v_leaf); __pyx_9genexpr26__pyx_v_leaf = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr26__pyx_v_leaf); __pyx_9genexpr26__pyx_v_leaf = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_t_8 = PyUnicode_Join(__pyx_kp_u__34, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_8);
  __pyx_t_8 = 0;
  __Pyx_INCREF(__pyx_kp_u__35);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__35);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__35);

  /* "mathics/core/expression.py":1664
 * 
 *     def default_format(self, evaluation, form) -> str:
 *         return "%s[%s]" % (             # <<<<<<<<<<<<<<
 *             self._head.default_format(evaluation, form),
 *             ", ".join([leaf.default_format(evaluation, form) for leaf in self._leaves]),
 */
  __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1663
 *             raise BoxError(self, "tex")
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[%s]" % (
 *             self._head.default_format(evaluation, form),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("mathics.core.expression.Expression.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_9genexpr26__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1669
 *         )
 * 
 *     def sort(self, pattern=False):             # <<<<<<<<<<<<<<
 *         "Sort the leaves according to internal ordering."
 *         leaves = list(self._leaves)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_95sort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_10Expression_94sort[] = "Sort the leaves according to internal ordering.";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_95sort = {"sort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_95sort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_10Expression_94sort};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_95sort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_pattern = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sort (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_pattern,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sort") < 0)) __PYX_ERR(0, 1669, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_pattern = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sort", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1669, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.sort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_94sort(__pyx_self, __pyx_v_self, __pyx_v_pattern);

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

/* "mathics/core/expression.py":1673
 *         leaves = list(self._leaves)
 *         if pattern:
 *             leaves.sort(key=lambda e: e.get_sort_key(pattern_sort=True))             # <<<<<<<<<<<<<<
 *         else:
 *             leaves.sort()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_4sort_lambda10(PyObject *__pyx_self, PyObject *__pyx_v_e); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_4sort_lambda10 = {"lambda10", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_4sort_lambda10, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_4sort_lambda10(PyObject *__pyx_self, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda10 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda10(__pyx_self, ((PyObject *)__pyx_v_e));

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

static PyObject *__pyx_lambda_funcdef_lambda10(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_e) {
  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("lambda10", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_e, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_pattern_sort, Py_True) < 0) __PYX_ERR(0, 1673, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Expression.sort.lambda10", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1669
 *         )
 * 
 *     def sort(self, pattern=False):             # <<<<<<<<<<<<<<
 *         "Sort the leaves according to internal ordering."
 *         leaves = list(self._leaves)
 */

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

  /* "mathics/core/expression.py":1671
 *     def sort(self, pattern=False):
 *         "Sort the leaves according to internal ordering."
 *         leaves = list(self._leaves)             # <<<<<<<<<<<<<<
 *         if pattern:
 *             leaves.sort(key=lambda e: e.get_sort_key(pattern_sort=True))
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_leaves = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1672
 *         "Sort the leaves according to internal ordering."
 *         leaves = list(self._leaves)
 *         if pattern:             # <<<<<<<<<<<<<<
 *             leaves.sort(key=lambda e: e.get_sort_key(pattern_sort=True))
 *         else:
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_pattern); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1672, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":1673
 *         leaves = list(self._leaves)
 *         if pattern:
 *             leaves.sort(key=lambda e: e.get_sort_key(pattern_sort=True))             # <<<<<<<<<<<<<<
 *         else:
 *             leaves.sort()
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaves, __pyx_n_s_sort); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_4sort_lambda10, 0, __pyx_n_s_Expression_sort_locals_lambda, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_key, __pyx_t_4) < 0) __PYX_ERR(0, 1673, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1673, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1672
 *         "Sort the leaves according to internal ordering."
 *         leaves = list(self._leaves)
 *         if pattern:             # <<<<<<<<<<<<<<
 *             leaves.sort(key=lambda e: e.get_sort_key(pattern_sort=True))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":1675
 *             leaves.sort(key=lambda e: e.get_sort_key(pattern_sort=True))
 *         else:
 *             leaves.sort()             # <<<<<<<<<<<<<<
 *         self.set_reordered_leaves(leaves)
 * 
 */
  /*else*/ {
    __pyx_t_5 = PyList_Sort(__pyx_v_leaves); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1675, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":1676
 *         else:
 *             leaves.sort()
 *         self.set_reordered_leaves(leaves)             # <<<<<<<<<<<<<<
 * 
 *     def filter_leaves(self, head_name):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_reordered_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_leaves) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_leaves);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1669
 *         )
 * 
 *     def sort(self, pattern=False):             # <<<<<<<<<<<<<<
 *         "Sort the leaves according to internal ordering."
 *         leaves = list(self._leaves)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.Expression.sort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1678
 *         self.set_reordered_leaves(leaves)
 * 
 *     def filter_leaves(self, head_name):             # <<<<<<<<<<<<<<
 *         # TODO: should use sorting
 *         head_name = ensure_context(head_name)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_97filter_leaves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_97filter_leaves = {"filter_leaves", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_97filter_leaves, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_97filter_leaves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_head_name = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter_leaves (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_head_name,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_head_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter_leaves", 1, 2, 2, 1); __PYX_ERR(0, 1678, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filter_leaves") < 0)) __PYX_ERR(0, 1678, __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_head_name = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter_leaves", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1678, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.filter_leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_96filter_leaves(__pyx_self, __pyx_v_self, __pyx_v_head_name);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_96filter_leaves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_head_name) {
  PyObject *__pyx_9genexpr27__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter_leaves", 0);
  __Pyx_INCREF(__pyx_v_head_name);

  /* "mathics/core/expression.py":1680
 *     def filter_leaves(self, head_name):
 *         # TODO: should use sorting
 *         head_name = ensure_context(head_name)             # <<<<<<<<<<<<<<
 * 
 *         if self._no_symbol(head_name):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_context); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_head_name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_head_name);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_head_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1682
 *         head_name = ensure_context(head_name)
 * 
 *         if self._no_symbol(head_name):             # <<<<<<<<<<<<<<
 *             return []
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_no_symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1682, __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_head_name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_head_name);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1682, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1683
 * 
 *         if self._no_symbol(head_name):
 *             return []             # <<<<<<<<<<<<<<
 *         else:
 *             return [leaf for leaf in self._leaves if leaf.get_head_name() == head_name]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1683, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1682
 *         head_name = ensure_context(head_name)
 * 
 *         if self._no_symbol(head_name):             # <<<<<<<<<<<<<<
 *             return []
 *         else:
 */
  }

  /* "mathics/core/expression.py":1685
 *             return []
 *         else:
 *             return [leaf for leaf in self._leaves if leaf.get_head_name() == head_name]             # <<<<<<<<<<<<<<
 * 
 *     def apply_rules(self, rules, evaluation, level=0, options=None):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1685, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
        __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1685, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1685, __pyx_L6_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1685, __pyx_L6_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          } else {
            if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1685, __pyx_L6_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L6_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          }
        } else {
          __pyx_t_2 = __pyx_t_6(__pyx_t_3);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1685, __pyx_L6_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XDECREF_SET(__pyx_9genexpr27__pyx_v_leaf, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr27__pyx_v_leaf, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1685, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L6_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_v_head_name, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1685, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1685, __pyx_L6_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (__pyx_t_4) {
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr27__pyx_v_leaf))) __PYX_ERR(0, 1685, __pyx_L6_error)
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_leaf); __pyx_9genexpr27__pyx_v_leaf = 0;
      goto __pyx_L10_exit_scope;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_leaf); __pyx_9genexpr27__pyx_v_leaf = 0;
      goto __pyx_L1_error;
      __pyx_L10_exit_scope:;
    } /* exit inner scope */
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":1678
 *         self.set_reordered_leaves(leaves)
 * 
 *     def filter_leaves(self, head_name):             # <<<<<<<<<<<<<<
 *         # TODO: should use sorting
 *         head_name = ensure_context(head_name)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.core.expression.Expression.filter_leaves", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_9genexpr27__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_v_head_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1687
 *             return [leaf for leaf in self._leaves if leaf.get_head_name() == head_name]
 * 
 *     def apply_rules(self, rules, evaluation, level=0, options=None):             # <<<<<<<<<<<<<<
 *         """for rule in rules:
 *         result = rule.apply(self, evaluation, fully=False)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_99apply_rules(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_10Expression_98apply_rules[] = "for rule in rules:\n        result = rule.apply(self, evaluation, fully=False)\n        if result is not None:\n            return result";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_99apply_rules = {"apply_rules", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_99apply_rules, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_10Expression_98apply_rules};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_99apply_rules(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_rules = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_level = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_rules (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rules,&__pyx_n_s_evaluation,&__pyx_n_s_level,&__pyx_n_s_options,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)__pyx_int_0));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rules)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_rules", 0, 3, 5, 1); __PYX_ERR(0, 1687, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_rules", 0, 3, 5, 2); __PYX_ERR(0, 1687, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level);
          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_options);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_rules") < 0)) __PYX_ERR(0, 1687, __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_self = values[0];
    __pyx_v_rules = values[1];
    __pyx_v_evaluation = values[2];
    __pyx_v_level = values[3];
    __pyx_v_options = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_rules", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1687, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.apply_rules", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_98apply_rules(__pyx_self, __pyx_v_self, __pyx_v_rules, __pyx_v_evaluation, __pyx_v_level, __pyx_v_options);

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

/* "mathics/core/expression.py":1696
 *         new_applied = [False]
 * 
 *         def apply_leaf(leaf):             # <<<<<<<<<<<<<<
 *             new, sub_applied = leaf.apply_rules(rules, evaluation, level + 1, options)
 *             new_applied[0] = new_applied[0] or sub_applied
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_11apply_rules_1apply_leaf(PyObject *__pyx_self, PyObject *__pyx_v_leaf); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_11apply_rules_1apply_leaf = {"apply_leaf", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_11apply_rules_1apply_leaf, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_11apply_rules_1apply_leaf(PyObject *__pyx_self, PyObject *__pyx_v_leaf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_leaf (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_11apply_rules_apply_leaf(__pyx_self, ((PyObject *)__pyx_v_leaf));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_11apply_rules_apply_leaf(PyObject *__pyx_self, PyObject *__pyx_v_leaf) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *__pyx_cur_scope;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *__pyx_outer_scope;
  PyObject *__pyx_v_new = NULL;
  PyObject *__pyx_v_sub_applied = 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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_leaf", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/core/expression.py":1697
 * 
 *         def apply_leaf(leaf):
 *             new, sub_applied = leaf.apply_rules(rules, evaluation, level + 1, options)             # <<<<<<<<<<<<<<
 *             new_applied[0] = new_applied[0] or sub_applied
 *             return new
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_apply_rules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_rules)) { __Pyx_RaiseClosureNameError("rules"); __PYX_ERR(0, 1697, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 1697, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_level)) { __Pyx_RaiseClosureNameError("level"); __PYX_ERR(0, 1697, __pyx_L1_error) }
  __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_cur_scope->__pyx_v_level, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (unlikely(!__pyx_cur_scope->__pyx_v_options)) { __Pyx_RaiseClosureNameError("options"); __PYX_ERR(0, 1697, __pyx_L1_error) }
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_rules, __pyx_cur_scope->__pyx_v_evaluation, __pyx_t_3, __pyx_cur_scope->__pyx_v_options};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1697, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_rules, __pyx_cur_scope->__pyx_v_evaluation, __pyx_t_3, __pyx_cur_scope->__pyx_v_options};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 4+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1697, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(4+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1697, __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_cur_scope->__pyx_v_rules);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_rules);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_cur_scope->__pyx_v_rules);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_cur_scope->__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_t_3);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_options);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_options);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_cur_scope->__pyx_v_options);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  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, 1697, __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_6 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_6)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 2) < 0) __PYX_ERR(0, 1697, __pyx_L1_error)
    __pyx_t_7 = 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_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1697, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_new = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_sub_applied = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "mathics/core/expression.py":1698
 *         def apply_leaf(leaf):
 *             new, sub_applied = leaf.apply_rules(rules, evaluation, level + 1, options)
 *             new_applied[0] = new_applied[0] or sub_applied             # <<<<<<<<<<<<<<
 *             return new
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_new_applied)) { __Pyx_RaiseClosureNameError("new_applied"); __PYX_ERR(0, 1698, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_new_applied == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1698, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_new_applied, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1698, __pyx_L1_error)
  if (!__pyx_t_8) {
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_1 = __pyx_t_6;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_v_sub_applied);
  __pyx_t_1 = __pyx_v_sub_applied;
  __pyx_L5_bool_binop_done:;
  if (unlikely(!__pyx_cur_scope->__pyx_v_new_applied)) { __Pyx_RaiseClosureNameError("new_applied"); __PYX_ERR(0, 1698, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_v_new_applied == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1698, __pyx_L1_error)
  }
  if (unlikely(__Pyx_SetItemInt(__pyx_cur_scope->__pyx_v_new_applied, 0, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 1698, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1699
 *             new, sub_applied = leaf.apply_rules(rules, evaluation, level + 1, options)
 *             new_applied[0] = new_applied[0] or sub_applied
 *             return new             # <<<<<<<<<<<<<<
 * 
 *         def descend(expr):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_new);
  __pyx_r = __pyx_v_new;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1696
 *         new_applied = [False]
 * 
 *         def apply_leaf(leaf):             # <<<<<<<<<<<<<<
 *             new, sub_applied = leaf.apply_rules(rules, evaluation, level + 1, options)
 *             new_applied[0] = new_applied[0] or sub_applied
 */

  /* 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("mathics.core.expression.Expression.apply_rules.apply_leaf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_new);
  __Pyx_XDECREF(__pyx_v_sub_applied);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1701
 *             return new
 * 
 *         def descend(expr):             # <<<<<<<<<<<<<<
 *             return Expression(expr._head, *[apply_leaf(leaf) for leaf in expr._leaves])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_11apply_rules_3descend(PyObject *__pyx_self, PyObject *__pyx_v_expr); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_11apply_rules_3descend = {"descend", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_11apply_rules_3descend, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_11apply_rules_3descend(PyObject *__pyx_self, PyObject *__pyx_v_expr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("descend (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_11apply_rules_2descend(__pyx_self, ((PyObject *)__pyx_v_expr));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_11apply_rules_2descend(PyObject *__pyx_self, PyObject *__pyx_v_expr) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *__pyx_cur_scope;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *__pyx_outer_scope;
  PyObject *__pyx_9genexpr28__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("descend", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/core/expression.py":1702
 * 
 *         def descend(expr):
 *             return Expression(expr._head, *[apply_leaf(leaf) for leaf in expr._leaves])             # <<<<<<<<<<<<<<
 * 
 *         if options is None:  # default ReplaceAll mode; replace breadth first
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1702, __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;
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1702, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1702, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1702, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1702, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1702, __pyx_L5_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1702, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1702, __pyx_L5_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1702, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_7(__pyx_t_5);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1702, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr28__pyx_v_leaf, __pyx_t_4);
      __pyx_t_4 = 0;
      if (unlikely(!__pyx_cur_scope->__pyx_v_apply_leaf)) { __Pyx_RaiseClosureNameError("apply_leaf"); __PYX_ERR(0, 1702, __pyx_L5_error) }
      __pyx_t_4 = __pyx_pf_7mathics_4core_10expression_10Expression_11apply_rules_apply_leaf(__pyx_cur_scope->__pyx_v_apply_leaf, __pyx_9genexpr28__pyx_v_leaf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1702, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 1702, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_9genexpr28__pyx_v_leaf); __pyx_9genexpr28__pyx_v_leaf = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr28__pyx_v_leaf); __pyx_9genexpr28__pyx_v_leaf = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __pyx_t_5 = PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1701
 *             return new
 * 
 *         def descend(expr):             # <<<<<<<<<<<<<<
 *             return Expression(expr._head, *[apply_leaf(leaf) for leaf in expr._leaves])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Expression.apply_rules.descend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_9genexpr28__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1687
 *             return [leaf for leaf in self._leaves if leaf.get_head_name() == head_name]
 * 
 *     def apply_rules(self, rules, evaluation, level=0, options=None):             # <<<<<<<<<<<<<<
 *         """for rule in rules:
 *         result = rule.apply(self, evaluation, fully=False)
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_98apply_rules(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rules, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_level, PyObject *__pyx_v_options) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *__pyx_cur_scope;
  PyObject *__pyx_v_descend = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_applied = NULL;
  PyObject *__pyx_v_head = NULL;
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_rules", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1687, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_rules = __pyx_v_rules;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rules);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_rules);
  __pyx_cur_scope->__pyx_v_evaluation = __pyx_v_evaluation;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
  __pyx_cur_scope->__pyx_v_level = __pyx_v_level;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_level);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_level);
  __pyx_cur_scope->__pyx_v_options = __pyx_v_options;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_options);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_options);

  /* "mathics/core/expression.py":1694
 * 
 *         # to be able to access it inside inner function
 *         new_applied = [False]             # <<<<<<<<<<<<<<
 * 
 *         def apply_leaf(leaf):
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  PyList_SET_ITEM(__pyx_t_1, 0, Py_False);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_new_applied = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1696
 *         new_applied = [False]
 * 
 *         def apply_leaf(leaf):             # <<<<<<<<<<<<<<
 *             new, sub_applied = leaf.apply_rules(rules, evaluation, level + 1, options)
 *             new_applied[0] = new_applied[0] or sub_applied
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_11apply_rules_1apply_leaf, 0, __pyx_n_s_Expression_apply_rules_locals_ap, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_apply_leaf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1701
 *             return new
 * 
 *         def descend(expr):             # <<<<<<<<<<<<<<
 *             return Expression(expr._head, *[apply_leaf(leaf) for leaf in expr._leaves])
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_11apply_rules_3descend, 0, __pyx_n_s_Expression_apply_rules_locals_de, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_descend = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1704
 *             return Expression(expr._head, *[apply_leaf(leaf) for leaf in expr._leaves])
 * 
 *         if options is None:  # default ReplaceAll mode; replace breadth first             # <<<<<<<<<<<<<<
 *             result, applied = super().apply_rules(rules, evaluation, level, options)
 *             if applied:
 */
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_options == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":1705
 * 
 *         if options is None:  # default ReplaceAll mode; replace breadth first
 *             result, applied = super().apply_rules(rules, evaluation, level, options)             # <<<<<<<<<<<<<<
 *             if applied:
 *                 return result, True
 */
    __pyx_t_4 = __Pyx_CyFunction_GetClassObj(__pyx_self);
    if (!__pyx_t_4) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 1705, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1705, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_self);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1705, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_apply_rules); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1705, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    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 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_rules, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_level, __pyx_cur_scope->__pyx_v_options};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1705, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_rules, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_level, __pyx_cur_scope->__pyx_v_options};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1705, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1705, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rules);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_rules);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_rules);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_evaluation);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_level);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_level);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_cur_scope->__pyx_v_level);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_options);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_options);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_cur_scope->__pyx_v_options);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1705, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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, 1705, __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_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1705, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1705, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #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, 1705, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1705, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L5_unpacking_done;
      __pyx_L4_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1705, __pyx_L1_error)
      __pyx_L5_unpacking_done:;
    }
    __pyx_v_result = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_applied = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "mathics/core/expression.py":1706
 *         if options is None:  # default ReplaceAll mode; replace breadth first
 *             result, applied = super().apply_rules(rules, evaluation, level, options)
 *             if applied:             # <<<<<<<<<<<<<<
 *                 return result, True
 *             head, applied = self._head.apply_rules(rules, evaluation, level, options)
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_applied); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1706, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "mathics/core/expression.py":1707
 *             result, applied = super().apply_rules(rules, evaluation, level, options)
 *             if applied:
 *                 return result, True             # <<<<<<<<<<<<<<
 *             head, applied = self._head.apply_rules(rules, evaluation, level, options)
 *             new_applied[0] = applied
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1707, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_result);
      __Pyx_GIVEREF(__pyx_v_result);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_result);
      __Pyx_INCREF(Py_True);
      __Pyx_GIVEREF(Py_True);
      PyTuple_SET_ITEM(__pyx_t_1, 1, Py_True);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":1706
 *         if options is None:  # default ReplaceAll mode; replace breadth first
 *             result, applied = super().apply_rules(rules, evaluation, level, options)
 *             if applied:             # <<<<<<<<<<<<<<
 *                 return result, True
 *             head, applied = self._head.apply_rules(rules, evaluation, level, options)
 */
    }

    /* "mathics/core/expression.py":1708
 *             if applied:
 *                 return result, True
 *             head, applied = self._head.apply_rules(rules, evaluation, level, options)             # <<<<<<<<<<<<<<
 *             new_applied[0] = applied
 *             return descend(Expression(head, *self._leaves)), new_applied[0]
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_apply_rules); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_cur_scope->__pyx_v_rules, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_level, __pyx_cur_scope->__pyx_v_options};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1708, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_cur_scope->__pyx_v_rules, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_level, __pyx_cur_scope->__pyx_v_options};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1708, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rules);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_rules);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_rules);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_evaluation);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_level);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_level);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_cur_scope->__pyx_v_level);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_options);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_options);
      PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_6, __pyx_cur_scope->__pyx_v_options);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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, 1708, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1708, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_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, 1708, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __pyx_v_head = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_applied, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1709
 *                 return result, True
 *             head, applied = self._head.apply_rules(rules, evaluation, level, options)
 *             new_applied[0] = applied             # <<<<<<<<<<<<<<
 *             return descend(Expression(head, *self._leaves)), new_applied[0]
 *         else:  # Replace mode; replace depth first
 */
    if (unlikely(__Pyx_SetItemInt(__pyx_cur_scope->__pyx_v_new_applied, 0, __pyx_v_applied, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 1709, __pyx_L1_error)

    /* "mathics/core/expression.py":1710
 *             head, applied = self._head.apply_rules(rules, evaluation, level, options)
 *             new_applied[0] = applied
 *             return descend(Expression(head, *self._leaves)), new_applied[0]             # <<<<<<<<<<<<<<
 *         else:  # Replace mode; replace depth first
 *             expr = descend(self)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_head);
    __Pyx_GIVEREF(__pyx_v_head);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_head);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_pf_7mathics_4core_10expression_10Expression_11apply_rules_2descend(__pyx_v_descend, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_new_applied, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1710, __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_7);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
    __pyx_t_5 = 0;
    __pyx_t_7 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1704
 *             return Expression(expr._head, *[apply_leaf(leaf) for leaf in expr._leaves])
 * 
 *         if options is None:  # default ReplaceAll mode; replace breadth first             # <<<<<<<<<<<<<<
 *             result, applied = super().apply_rules(rules, evaluation, level, options)
 *             if applied:
 */
  }

  /* "mathics/core/expression.py":1712
 *             return descend(Expression(head, *self._leaves)), new_applied[0]
 *         else:  # Replace mode; replace depth first
 *             expr = descend(self)             # <<<<<<<<<<<<<<
 *             expr, applied = super(Expression, expr).apply_rules(
 *                 rules, evaluation, level, options
 */
  /*else*/ {
    __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_10Expression_11apply_rules_2descend(__pyx_v_descend, __pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1712, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_expr = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1713
 *         else:  # Replace mode; replace depth first
 *             expr = descend(self)
 *             expr, applied = super(Expression, expr).apply_rules(             # <<<<<<<<<<<<<<
 *                 rules, evaluation, level, options
 *             )
 */
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Expression); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
    __Pyx_INCREF(__pyx_v_expr);
    __Pyx_GIVEREF(__pyx_v_expr);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_expr);
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_apply_rules); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "mathics/core/expression.py":1714
 *             expr = descend(self)
 *             expr, applied = super(Expression, expr).apply_rules(
 *                 rules, evaluation, level, options             # <<<<<<<<<<<<<<
 *             )
 *             new_applied[0] = new_applied[0] or applied
 */
    __pyx_t_7 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_cur_scope->__pyx_v_rules, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_level, __pyx_cur_scope->__pyx_v_options};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1713, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_cur_scope->__pyx_v_rules, __pyx_cur_scope->__pyx_v_evaluation, __pyx_cur_scope->__pyx_v_level, __pyx_cur_scope->__pyx_v_options};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1713, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rules);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_rules);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_rules);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_evaluation);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_level);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_level);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_cur_scope->__pyx_v_level);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_options);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_options);
      PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_6, __pyx_cur_scope->__pyx_v_options);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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, 1713, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1713, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L10_unpacking_done;
      __pyx_L9_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, 1713, __pyx_L1_error)
      __pyx_L10_unpacking_done:;
    }

    /* "mathics/core/expression.py":1713
 *         else:  # Replace mode; replace depth first
 *             expr = descend(self)
 *             expr, applied = super(Expression, expr).apply_rules(             # <<<<<<<<<<<<<<
 *                 rules, evaluation, level, options
 *             )
 */
    __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_applied = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1716
 *                 rules, evaluation, level, options
 *             )
 *             new_applied[0] = new_applied[0] or applied             # <<<<<<<<<<<<<<
 *             if not applied and options["heads"]:
 *                 # heads in Replace are treated at the level of the arguments, i.e. level + 1
 */
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_new_applied, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1716, __pyx_L1_error)
    if (!__pyx_t_3) {
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_1 = __pyx_t_4;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L11_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_v_applied);
    __pyx_t_1 = __pyx_v_applied;
    __pyx_L11_bool_binop_done:;
    if (unlikely(__Pyx_SetItemInt(__pyx_cur_scope->__pyx_v_new_applied, 0, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 1716, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1717
 *             )
 *             new_applied[0] = new_applied[0] or applied
 *             if not applied and options["heads"]:             # <<<<<<<<<<<<<<
 *                 # heads in Replace are treated at the level of the arguments, i.e. level + 1
 *                 head, applied = expr._head.apply_rules(
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_applied); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __pyx_t_9 = ((!__pyx_t_2) != 0);
    if (__pyx_t_9) {
    } else {
      __pyx_t_3 = __pyx_t_9;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_cur_scope->__pyx_v_options, __pyx_n_u_heads); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1717, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __pyx_t_9;
    __pyx_L14_bool_binop_done:;
    if (__pyx_t_3) {

      /* "mathics/core/expression.py":1719
 *             if not applied and options["heads"]:
 *                 # heads in Replace are treated at the level of the arguments, i.e. level + 1
 *                 head, applied = expr._head.apply_rules(             # <<<<<<<<<<<<<<
 *                     rules, evaluation, level + 1, options
 *                 )
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_head_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_apply_rules); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "mathics/core/expression.py":1720
 *                 # heads in Replace are treated at the level of the arguments, i.e. level + 1
 *                 head, applied = expr._head.apply_rules(
 *                     rules, evaluation, level + 1, options             # <<<<<<<<<<<<<<
 *                 )
 *                 new_applied[0] = new_applied[0] or applied
 */
      __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_cur_scope->__pyx_v_level, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1720, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_cur_scope->__pyx_v_rules, __pyx_cur_scope->__pyx_v_evaluation, __pyx_t_4, __pyx_cur_scope->__pyx_v_options};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1719, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_cur_scope->__pyx_v_rules, __pyx_cur_scope->__pyx_v_evaluation, __pyx_t_4, __pyx_cur_scope->__pyx_v_options};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1719, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_rules);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_rules);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_rules);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_evaluation);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_6, __pyx_t_4);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_options);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_options);
        PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_6, __pyx_cur_scope->__pyx_v_options);
        __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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, 1719, __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_10 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_10);
        #else
        __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #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, 1719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L16_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 1; __pyx_t_10 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_10)) goto __pyx_L16_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1719, __pyx_L1_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L17_unpacking_done;
        __pyx_L16_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1719, __pyx_L1_error)
        __pyx_L17_unpacking_done:;
      }

      /* "mathics/core/expression.py":1719
 *             if not applied and options["heads"]:
 *                 # heads in Replace are treated at the level of the arguments, i.e. level + 1
 *                 head, applied = expr._head.apply_rules(             # <<<<<<<<<<<<<<
 *                     rules, evaluation, level + 1, options
 *                 )
 */
      __pyx_v_head = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_applied, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "mathics/core/expression.py":1722
 *                     rules, evaluation, level + 1, options
 *                 )
 *                 new_applied[0] = new_applied[0] or applied             # <<<<<<<<<<<<<<
 *                 expr = Expression(head, *expr._leaves)
 *             return expr, new_applied[0]
 */
      __pyx_t_10 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_new_applied, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1722, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1722, __pyx_L1_error)
      if (!__pyx_t_3) {
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_10);
        __pyx_t_1 = __pyx_t_10;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L18_bool_binop_done;
      }
      __Pyx_INCREF(__pyx_v_applied);
      __pyx_t_1 = __pyx_v_applied;
      __pyx_L18_bool_binop_done:;
      if (unlikely(__Pyx_SetItemInt(__pyx_cur_scope->__pyx_v_new_applied, 0, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 1722, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/core/expression.py":1723
 *                 )
 *                 new_applied[0] = new_applied[0] or applied
 *                 expr = Expression(head, *expr._leaves)             # <<<<<<<<<<<<<<
 *             return expr, new_applied[0]
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_head);
      __Pyx_GIVEREF(__pyx_v_head);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_head);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "mathics/core/expression.py":1717
 *             )
 *             new_applied[0] = new_applied[0] or applied
 *             if not applied and options["heads"]:             # <<<<<<<<<<<<<<
 *                 # heads in Replace are treated at the level of the arguments, i.e. level + 1
 *                 head, applied = expr._head.apply_rules(
 */
    }

    /* "mathics/core/expression.py":1724
 *                 new_applied[0] = new_applied[0] or applied
 *                 expr = Expression(head, *expr._leaves)
 *             return expr, new_applied[0]             # <<<<<<<<<<<<<<
 * 
 *     def replace_vars(
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_new_applied, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_expr);
    __Pyx_GIVEREF(__pyx_v_expr);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_expr);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":1687
 *             return [leaf for leaf in self._leaves if leaf.get_head_name() == head_name]
 * 
 *     def apply_rules(self, rules, evaluation, level=0, options=None):             # <<<<<<<<<<<<<<
 *         """for rule in rules:
 *         result = rule.apply(self, evaluation, fully=False)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.Expression.apply_rules", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_descend);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_applied);
  __Pyx_XDECREF(__pyx_v_head);
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1726
 *             return expr, new_applied[0]
 * 
 *     def replace_vars(             # <<<<<<<<<<<<<<
 *         self, vars, options=None, in_scoping=True, in_function=True
 *     ) -> "Expression":
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_101replace_vars(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_101replace_vars = {"replace_vars", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_101replace_vars, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_101replace_vars(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_vars = 0;
  PyObject *__pyx_v_options = 0;
  PyObject *__pyx_v_in_scoping = 0;
  PyObject *__pyx_v_in_function = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace_vars (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_vars,&__pyx_n_s_options,&__pyx_n_s_in_scoping,&__pyx_n_s_in_function,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "mathics/core/expression.py":1727
 * 
 *     def replace_vars(
 *         self, vars, options=None, in_scoping=True, in_function=True             # <<<<<<<<<<<<<<
 *     ) -> "Expression":
 *         from mathics.builtin.scoping import get_scoping_vars
 */
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_True));
    values[4] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace_vars", 0, 2, 5, 1); __PYX_ERR(0, 1726, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          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_in_scoping);
          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_in_function);
          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_vars") < 0)) __PYX_ERR(0, 1726, __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_self = values[0];
    __pyx_v_vars = values[1];
    __pyx_v_options = values[2];
    __pyx_v_in_scoping = values[3];
    __pyx_v_in_function = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace_vars", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1726, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.replace_vars", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_100replace_vars(__pyx_self, __pyx_v_self, __pyx_v_vars, __pyx_v_options, __pyx_v_in_scoping, __pyx_v_in_function);

  /* "mathics/core/expression.py":1726
 *             return expr, new_applied[0]
 * 
 *     def replace_vars(             # <<<<<<<<<<<<<<
 *         self, vars, options=None, in_scoping=True, in_function=True
 *     ) -> "Expression":
 */

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

/* "mathics/core/expression.py":1739
 * 
 *                 scoping_vars = set(
 *                     name for name, new_def in get_scoping_vars(self._leaves[0])             # <<<<<<<<<<<<<<
 *                 )
 *                 """for var in new_vars:
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_12replace_vars_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_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_7mathics_4core_10expression___pyx_scope_struct_24_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_24_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_24_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1739, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *) __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_7mathics_4core_10expression_10Expression_12replace_vars_2generator11, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Expression_replace_vars_locals_g, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 1739, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.replace_vars.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_7mathics_4core_10expression_10Expression_12replace_vars_2generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1739, __pyx_L1_error)
  __pyx_r = PySet_New(NULL); if (unlikely(!__pyx_r)) __PYX_ERR(0, 1739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_get_scoping_vars)) { __Pyx_RaiseClosureNameError("get_scoping_vars"); __PYX_ERR(0, 1739, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1739, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_get_scoping_vars);
  __pyx_t_2 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_get_scoping_vars; __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1739, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1739, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1739, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1739, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1739, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1739, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_6(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1739, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      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, 1739, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1739, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1739, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1739, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1739, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1739, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_new_def);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_new_def, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(PySet_Add(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_name))) __PYX_ERR(0, 1739, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

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

/* "mathics/core/expression.py":1726
 *             return expr, new_applied[0]
 * 
 *     def replace_vars(             # <<<<<<<<<<<<<<
 *         self, vars, options=None, in_scoping=True, in_function=True
 *     ) -> "Expression":
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_100replace_vars(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_vars, PyObject *__pyx_v_options, PyObject *__pyx_v_in_scoping, PyObject *__pyx_v_in_function) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *__pyx_cur_scope;
  PyObject *__pyx_v_scoping_vars = NULL;
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_v_func_params = NULL;
  PyObject *__pyx_v_body = NULL;
  PyObject *__pyx_v_replacement = NULL;
  PyObject *__pyx_9genexpr30__pyx_v_var = NULL;
  PyObject *__pyx_9genexpr30__pyx_v_value = NULL;
  PyObject *__pyx_9genexpr31__pyx_v_leaf = NULL;
  PyObject *__pyx_9genexpr32__pyx_v_name = NULL;
  PyObject *__pyx_9genexpr33__pyx_v_name = NULL;
  PyObject *__pyx_9genexpr34__pyx_v_leaf = NULL;
  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_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace_vars", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1726, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_INCREF(__pyx_v_vars);

  /* "mathics/core/expression.py":1729
 *         self, vars, options=None, in_scoping=True, in_function=True
 *     ) -> "Expression":
 *         from mathics.builtin.scoping import get_scoping_vars             # <<<<<<<<<<<<<<
 * 
 *         if not in_scoping:
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_get_scoping_vars);
  __Pyx_GIVEREF(__pyx_n_s_get_scoping_vars);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_scoping_vars);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_builtin_scoping, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1729, __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_get_scoping_vars); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_get_scoping_vars = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1731
 *         from mathics.builtin.scoping import get_scoping_vars
 * 
 *         if not in_scoping:             # <<<<<<<<<<<<<<
 *             if (
 *                 self._head.get_name()
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_in_scoping); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1731, __pyx_L1_error)
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1733
 *         if not in_scoping:
 *             if (
 *                 self._head.get_name()             # <<<<<<<<<<<<<<
 *                 in ("System`Module", "System`Block", "System`With")
 *                 and len(self._leaves) > 0
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1733, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1733, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1733, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mathics/core/expression.py":1734
 *             if (
 *                 self._head.get_name()
 *                 in ("System`Module", "System`Block", "System`With")             # <<<<<<<<<<<<<<
 *                 and len(self._leaves) > 0
 *             ):  # nopep8
 */
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_Module, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1734, __pyx_L1_error)
    if (!__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_Block, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1734, __pyx_L1_error)
    if (!__pyx_t_6) {
    } else {
      __pyx_t_3 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_With, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1734, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = (__pyx_t_3 != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_4 = __pyx_t_6;
      goto __pyx_L5_bool_binop_done;
    }

    /* "mathics/core/expression.py":1735
 *                 self._head.get_name()
 *                 in ("System`Module", "System`Block", "System`With")
 *                 and len(self._leaves) > 0             # <<<<<<<<<<<<<<
 *             ):  # nopep8
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1735, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1735, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = ((__pyx_t_7 > 0) != 0);
    __pyx_t_4 = __pyx_t_6;
    __pyx_L5_bool_binop_done:;

    /* "mathics/core/expression.py":1732
 * 
 *         if not in_scoping:
 *             if (             # <<<<<<<<<<<<<<
 *                 self._head.get_name()
 *                 in ("System`Module", "System`Block", "System`With")
 */
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":1739
 * 
 *                 scoping_vars = set(
 *                     name for name, new_def in get_scoping_vars(self._leaves[0])             # <<<<<<<<<<<<<<
 *                 )
 *                 """for var in new_vars:
 */
      __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_10Expression_12replace_vars_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1739, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "mathics/core/expression.py":1738
 *             ):  # nopep8
 * 
 *                 scoping_vars = set(             # <<<<<<<<<<<<<<
 *                     name for name, new_def in get_scoping_vars(self._leaves[0])
 *                 )
 */
      __pyx_t_5 = __Pyx_Generator_Next(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_scoping_vars = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "mathics/core/expression.py":1744
 *                     if var in scoping_vars:
 *                         del new_vars[var]"""
 *                 vars = {             # <<<<<<<<<<<<<<
 *                     var: value for var, value in vars.items() if var not in scoping_vars
 *                 }
 */
      { /* enter inner scope */
        __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1744, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_5);

        /* "mathics/core/expression.py":1745
 *                         del new_vars[var]"""
 *                 vars = {
 *                     var: value for var, value in vars.items() if var not in scoping_vars             # <<<<<<<<<<<<<<
 *                 }
 * 
 */
        __pyx_t_7 = 0;
        if (unlikely(__pyx_v_vars == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
          __PYX_ERR(0, 1745, __pyx_L12_error)
        }
        __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_vars, 0, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1745, __pyx_L12_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_XDECREF(__pyx_t_2);
        __pyx_t_2 = __pyx_t_1;
        __pyx_t_1 = 0;
        while (1) {
          __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_8, &__pyx_t_7, &__pyx_t_1, &__pyx_t_10, NULL, __pyx_t_9);
          if (unlikely(__pyx_t_11 == 0)) break;
          if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 1745, __pyx_L12_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_XDECREF_SET(__pyx_9genexpr30__pyx_v_var, __pyx_t_1);
          __pyx_t_1 = 0;
          __Pyx_XDECREF_SET(__pyx_9genexpr30__pyx_v_value, __pyx_t_10);
          __pyx_t_10 = 0;
          if (unlikely(__pyx_v_scoping_vars == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
            __PYX_ERR(0, 1745, __pyx_L12_error)
          }
          __pyx_t_4 = (__Pyx_PySet_ContainsTF(__pyx_9genexpr30__pyx_v_var, __pyx_v_scoping_vars, Py_NE)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1745, __pyx_L12_error)
          __pyx_t_6 = (__pyx_t_4 != 0);
          if (__pyx_t_6) {
            if (unlikely(PyDict_SetItem(__pyx_t_5, (PyObject*)__pyx_9genexpr30__pyx_v_var, (PyObject*)__pyx_9genexpr30__pyx_v_value))) __PYX_ERR(0, 1745, __pyx_L12_error)
          }
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_value); __pyx_9genexpr30__pyx_v_value = 0;
        __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_var); __pyx_9genexpr30__pyx_v_var = 0;
        goto __pyx_L16_exit_scope;
        __pyx_L12_error:;
        __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_value); __pyx_9genexpr30__pyx_v_value = 0;
        __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_var); __pyx_9genexpr30__pyx_v_var = 0;
        goto __pyx_L1_error;
        __pyx_L16_exit_scope:;
      } /* exit inner scope */
      __Pyx_DECREF_SET(__pyx_v_vars, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "mathics/core/expression.py":1732
 * 
 *         if not in_scoping:
 *             if (             # <<<<<<<<<<<<<<
 *                 self._head.get_name()
 *                 in ("System`Module", "System`Block", "System`With")
 */
    }

    /* "mathics/core/expression.py":1731
 *         from mathics.builtin.scoping import get_scoping_vars
 * 
 *         if not in_scoping:             # <<<<<<<<<<<<<<
 *             if (
 *                 self._head.get_name()
 */
  }

  /* "mathics/core/expression.py":1748
 *                 }
 * 
 *         leaves = self._leaves             # <<<<<<<<<<<<<<
 *         if in_function:
 *             if (
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_leaves = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1749
 * 
 *         leaves = self._leaves
 *         if in_function:             # <<<<<<<<<<<<<<
 *             if (
 *                 self._head.get_name() == "System`Function"
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_in_function); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1749, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1751
 *         if in_function:
 *             if (
 *                 self._head.get_name() == "System`Function"             # <<<<<<<<<<<<<<
 *                 and len(self._leaves) > 1
 *                 and (
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_5, __pyx_kp_u_System_Function, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1751, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_4) {
    } else {
      __pyx_t_6 = __pyx_t_4;
      goto __pyx_L19_bool_binop_done;
    }

    /* "mathics/core/expression.py":1752
 *             if (
 *                 self._head.get_name() == "System`Function"
 *                 and len(self._leaves) > 1             # <<<<<<<<<<<<<<
 *                 and (
 *                     self._leaves[0].has_form("List", None) or self._leaves[0].get_name()
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1752, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = ((__pyx_t_8 > 1) != 0);
    if (__pyx_t_4) {
    } else {
      __pyx_t_6 = __pyx_t_4;
      goto __pyx_L19_bool_binop_done;
    }

    /* "mathics/core/expression.py":1754
 *                 and len(self._leaves) > 1
 *                 and (
 *                     self._leaves[0].has_form("List", None) or self._leaves[0].get_name()             # <<<<<<<<<<<<<<
 *                 )
 *             ):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_has_form); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!__pyx_t_4) {
    } else {
      __pyx_t_6 = __pyx_t_4;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_10 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1754, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_6 = __pyx_t_4;
    __pyx_L19_bool_binop_done:;

    /* "mathics/core/expression.py":1750
 *         leaves = self._leaves
 *         if in_function:
 *             if (             # <<<<<<<<<<<<<<
 *                 self._head.get_name() == "System`Function"
 *                 and len(self._leaves) > 1
 */
    if (__pyx_t_6) {

      /* "mathics/core/expression.py":1757
 *                 )
 *             ):
 *                 if self._leaves[0].get_name():             # <<<<<<<<<<<<<<
 *                     func_params = [self._leaves[0].get_name()]
 *                 else:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_10 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1757, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__pyx_t_6) {

        /* "mathics/core/expression.py":1758
 *             ):
 *                 if self._leaves[0].get_name():
 *                     func_params = [self._leaves[0].get_name()]             # <<<<<<<<<<<<<<
 *                 else:
 *                     func_params = [leaf.get_name() for leaf in self._leaves[0]._leaves]
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1758, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1758, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1758, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_10 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1758, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1758, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_10);
        PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_v_func_params = ((PyObject*)__pyx_t_5);
        __pyx_t_5 = 0;

        /* "mathics/core/expression.py":1757
 *                 )
 *             ):
 *                 if self._leaves[0].get_name():             # <<<<<<<<<<<<<<
 *                     func_params = [self._leaves[0].get_name()]
 *                 else:
 */
        goto __pyx_L23;
      }

      /* "mathics/core/expression.py":1760
 *                     func_params = [self._leaves[0].get_name()]
 *                 else:
 *                     func_params = [leaf.get_name() for leaf in self._leaves[0]._leaves]             # <<<<<<<<<<<<<<
 *                 if "" not in func_params:
 *                     body = self._leaves[1]
 */
      /*else*/ {
        { /* enter inner scope */
          __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1760, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1760, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1760, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1760, __pyx_L26_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (likely(PyList_CheckExact(__pyx_t_10)) || PyTuple_CheckExact(__pyx_t_10)) {
            __pyx_t_2 = __pyx_t_10; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
            __pyx_t_12 = NULL;
          } else {
            __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1760, __pyx_L26_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1760, __pyx_L26_error)
          }
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          for (;;) {
            if (likely(!__pyx_t_12)) {
              if (likely(PyList_CheckExact(__pyx_t_2))) {
                if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_10 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1760, __pyx_L26_error)
                #else
                __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1760, __pyx_L26_error)
                __Pyx_GOTREF(__pyx_t_10);
                #endif
              } else {
                if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1760, __pyx_L26_error)
                #else
                __pyx_t_10 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1760, __pyx_L26_error)
                __Pyx_GOTREF(__pyx_t_10);
                #endif
              }
            } else {
              __pyx_t_10 = __pyx_t_12(__pyx_t_2);
              if (unlikely(!__pyx_t_10)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                  else __PYX_ERR(0, 1760, __pyx_L26_error)
                }
                break;
              }
              __Pyx_GOTREF(__pyx_t_10);
            }
            __Pyx_XDECREF_SET(__pyx_9genexpr31__pyx_v_leaf, __pyx_t_10);
            __pyx_t_10 = 0;
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr31__pyx_v_leaf, __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1760, __pyx_L26_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_13 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
              __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
              if (likely(__pyx_t_13)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_13);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_1, function);
              }
            }
            __pyx_t_10 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1760, __pyx_L26_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 1760, __pyx_L26_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_9genexpr31__pyx_v_leaf); __pyx_9genexpr31__pyx_v_leaf = 0;
          goto __pyx_L29_exit_scope;
          __pyx_L26_error:;
          __Pyx_XDECREF(__pyx_9genexpr31__pyx_v_leaf); __pyx_9genexpr31__pyx_v_leaf = 0;
          goto __pyx_L1_error;
          __pyx_L29_exit_scope:;
        } /* exit inner scope */
        __pyx_v_func_params = ((PyObject*)__pyx_t_5);
        __pyx_t_5 = 0;
      }
      __pyx_L23:;

      /* "mathics/core/expression.py":1761
 *                 else:
 *                     func_params = [leaf.get_name() for leaf in self._leaves[0]._leaves]
 *                 if "" not in func_params:             # <<<<<<<<<<<<<<
 *                     body = self._leaves[1]
 *                     replacement = {name: Symbol(name + "$") for name in func_params}
 */
      __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__3, __pyx_v_func_params, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1761, __pyx_L1_error)
      __pyx_t_4 = (__pyx_t_6 != 0);
      if (__pyx_t_4) {

        /* "mathics/core/expression.py":1762
 *                     func_params = [leaf.get_name() for leaf in self._leaves[0]._leaves]
 *                 if "" not in func_params:
 *                     body = self._leaves[1]             # <<<<<<<<<<<<<<
 *                     replacement = {name: Symbol(name + "$") for name in func_params}
 *                     func_params = [Symbol(name + "$") for name in func_params]
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1762, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1762, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_body = __pyx_t_2;
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1763
 *                 if "" not in func_params:
 *                     body = self._leaves[1]
 *                     replacement = {name: Symbol(name + "$") for name in func_params}             # <<<<<<<<<<<<<<
 *                     func_params = [Symbol(name + "$") for name in func_params]
 *                     body = body.replace_vars(replacement, options, in_scoping)
 */
        { /* enter inner scope */
          __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1763, __pyx_L33_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __pyx_v_func_params; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
          for (;;) {
            if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_10 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1763, __pyx_L33_error)
            #else
            __pyx_t_10 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1763, __pyx_L33_error)
            __Pyx_GOTREF(__pyx_t_10);
            #endif
            __Pyx_XDECREF_SET(__pyx_9genexpr32__pyx_v_name, __pyx_t_10);
            __pyx_t_10 = 0;
            __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1763, __pyx_L33_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_13 = PyNumber_Add(__pyx_9genexpr32__pyx_v_name, __pyx_kp_u__65); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1763, __pyx_L33_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_14 = NULL;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
              __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
              if (likely(__pyx_t_14)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_14);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_1, function);
              }
            }
            __pyx_t_10 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13);
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1763, __pyx_L33_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(PyDict_SetItem(__pyx_t_2, (PyObject*)__pyx_9genexpr32__pyx_v_name, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 1763, __pyx_L33_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_9genexpr32__pyx_v_name); __pyx_9genexpr32__pyx_v_name = 0;
          goto __pyx_L36_exit_scope;
          __pyx_L33_error:;
          __Pyx_XDECREF(__pyx_9genexpr32__pyx_v_name); __pyx_9genexpr32__pyx_v_name = 0;
          goto __pyx_L1_error;
          __pyx_L36_exit_scope:;
        } /* exit inner scope */
        __pyx_v_replacement = ((PyObject*)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1764
 *                     body = self._leaves[1]
 *                     replacement = {name: Symbol(name + "$") for name in func_params}
 *                     func_params = [Symbol(name + "$") for name in func_params]             # <<<<<<<<<<<<<<
 *                     body = body.replace_vars(replacement, options, in_scoping)
 *                     leaves = chain(
 */
        { /* enter inner scope */
          __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1764, __pyx_L39_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __pyx_v_func_params; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
          for (;;) {
            if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_10 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1764, __pyx_L39_error)
            #else
            __pyx_t_10 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1764, __pyx_L39_error)
            __Pyx_GOTREF(__pyx_t_10);
            #endif
            __Pyx_XDECREF_SET(__pyx_9genexpr33__pyx_v_name, __pyx_t_10);
            __pyx_t_10 = 0;
            __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1764, __pyx_L39_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_13 = PyNumber_Add(__pyx_9genexpr33__pyx_v_name, __pyx_kp_u__65); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1764, __pyx_L39_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_14 = NULL;
            if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
              __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
              if (likely(__pyx_t_14)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_14);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_1, function);
              }
            }
            __pyx_t_10 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_13);
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1764, __pyx_L39_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 1764, __pyx_L39_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_9genexpr33__pyx_v_name); __pyx_9genexpr33__pyx_v_name = 0;
          goto __pyx_L42_exit_scope;
          __pyx_L39_error:;
          __Pyx_XDECREF(__pyx_9genexpr33__pyx_v_name); __pyx_9genexpr33__pyx_v_name = 0;
          goto __pyx_L1_error;
          __pyx_L42_exit_scope:;
        } /* exit inner scope */
        __Pyx_DECREF_SET(__pyx_v_func_params, ((PyObject*)__pyx_t_2));
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1765
 *                     replacement = {name: Symbol(name + "$") for name in func_params}
 *                     func_params = [Symbol(name + "$") for name in func_params]
 *                     body = body.replace_vars(replacement, options, in_scoping)             # <<<<<<<<<<<<<<
 *                     leaves = chain(
 *                         [Expression(SymbolList, *func_params), body], self._leaves[2:]
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_body, __pyx_n_s_replace_vars); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1765, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_10 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_replacement, __pyx_v_options, __pyx_v_in_scoping};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1765, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_v_replacement, __pyx_v_options, __pyx_v_in_scoping};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1765, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_1 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1765, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (__pyx_t_10) {
            __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); __pyx_t_10 = NULL;
          }
          __Pyx_INCREF(__pyx_v_replacement);
          __Pyx_GIVEREF(__pyx_v_replacement);
          PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_9, __pyx_v_replacement);
          __Pyx_INCREF(__pyx_v_options);
          __Pyx_GIVEREF(__pyx_v_options);
          PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_9, __pyx_v_options);
          __Pyx_INCREF(__pyx_v_in_scoping);
          __Pyx_GIVEREF(__pyx_v_in_scoping);
          PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_9, __pyx_v_in_scoping);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1765, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF_SET(__pyx_v_body, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1766
 *                     func_params = [Symbol(name + "$") for name in func_params]
 *                     body = body.replace_vars(replacement, options, in_scoping)
 *                     leaves = chain(             # <<<<<<<<<<<<<<
 *                         [Expression(SymbolList, *func_params), body], self._leaves[2:]
 *                     )
 */
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_chain); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1766, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);

        /* "mathics/core/expression.py":1767
 *                     body = body.replace_vars(replacement, options, in_scoping)
 *                     leaves = chain(
 *                         [Expression(SymbolList, *func_params), body], self._leaves[2:]             # <<<<<<<<<<<<<<
 *                     )
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1767, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1767, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1767, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_10 = PySequence_Tuple(__pyx_v_func_params); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1767, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_14 = PyNumber_Add(__pyx_t_13, __pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1767, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1767, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = PyList_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1767, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_10);
        PyList_SET_ITEM(__pyx_t_14, 0, __pyx_t_10);
        __Pyx_INCREF(__pyx_v_body);
        __Pyx_GIVEREF(__pyx_v_body);
        PyList_SET_ITEM(__pyx_t_14, 1, __pyx_v_body);
        __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1767, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_10, 2, 0, NULL, NULL, &__pyx_slice__66, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1767, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_14, __pyx_t_1};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1766, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_14, __pyx_t_1};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1766, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        {
          __pyx_t_13 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1766, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (__pyx_t_10) {
            __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10); __pyx_t_10 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_9, __pyx_t_14);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_9, __pyx_t_1);
          __pyx_t_14 = 0;
          __pyx_t_1 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1766, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF_SET(__pyx_v_leaves, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1761
 *                 else:
 *                     func_params = [leaf.get_name() for leaf in self._leaves[0]._leaves]
 *                 if "" not in func_params:             # <<<<<<<<<<<<<<
 *                     body = self._leaves[1]
 *                     replacement = {name: Symbol(name + "$") for name in func_params}
 */
      }

      /* "mathics/core/expression.py":1750
 *         leaves = self._leaves
 *         if in_function:
 *             if (             # <<<<<<<<<<<<<<
 *                 self._head.get_name() == "System`Function"
 *                 and len(self._leaves) > 1
 */
    }

    /* "mathics/core/expression.py":1749
 * 
 *         leaves = self._leaves
 *         if in_function:             # <<<<<<<<<<<<<<
 *             if (
 *                 self._head.get_name() == "System`Function"
 */
  }

  /* "mathics/core/expression.py":1770
 *                     )
 * 
 *         if not vars:  # might just be a symbol set via Set[] we looked up here             # <<<<<<<<<<<<<<
 *             return self.shallow_copy()
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_vars); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1770, __pyx_L1_error)
  __pyx_t_6 = ((!__pyx_t_4) != 0);
  if (__pyx_t_6) {

    /* "mathics/core/expression.py":1771
 * 
 *         if not vars:  # might just be a symbol set via Set[] we looked up here
 *             return self.shallow_copy()             # <<<<<<<<<<<<<<
 * 
 *         return Expression(
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_shallow_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1770
 *                     )
 * 
 *         if not vars:  # might just be a symbol set via Set[] we looked up here             # <<<<<<<<<<<<<<
 *             return self.shallow_copy()
 * 
 */
  }

  /* "mathics/core/expression.py":1773
 *             return self.shallow_copy()
 * 
 *         return Expression(             # <<<<<<<<<<<<<<
 *             self._head.replace_vars(vars, options=options, in_scoping=in_scoping),
 *             *[
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "mathics/core/expression.py":1774
 * 
 *         return Expression(
 *             self._head.replace_vars(vars, options=options, in_scoping=in_scoping),             # <<<<<<<<<<<<<<
 *             *[
 *                 leaf.replace_vars(vars, options=options, in_scoping=in_scoping)
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_replace_vars); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_vars);
  __Pyx_GIVEREF(__pyx_v_vars);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_vars);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_options, __pyx_v_options) < 0) __PYX_ERR(0, 1774, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_in_scoping, __pyx_v_in_scoping) < 0) __PYX_ERR(0, 1774, __pyx_L1_error)
  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1773
 *             return self.shallow_copy()
 * 
 *         return Expression(             # <<<<<<<<<<<<<<
 *             self._head.replace_vars(vars, options=options, in_scoping=in_scoping),
 *             *[
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_14);
  __pyx_t_14 = 0;
  { /* enter inner scope */

    /* "mathics/core/expression.py":1775
 *         return Expression(
 *             self._head.replace_vars(vars, options=options, in_scoping=in_scoping),
 *             *[             # <<<<<<<<<<<<<<
 *                 leaf.replace_vars(vars, options=options, in_scoping=in_scoping)
 *                 for leaf in leaves
 */
    __pyx_t_14 = PyList_New(0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1775, __pyx_L46_error)
    __Pyx_GOTREF(__pyx_t_14);

    /* "mathics/core/expression.py":1777
 *             *[
 *                 leaf.replace_vars(vars, options=options, in_scoping=in_scoping)
 *                 for leaf in leaves             # <<<<<<<<<<<<<<
 *             ]
 *         )
 */
    if (likely(PyList_CheckExact(__pyx_v_leaves)) || PyTuple_CheckExact(__pyx_v_leaves)) {
      __pyx_t_5 = __pyx_v_leaves; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
      __pyx_t_12 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_leaves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1777, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1777, __pyx_L46_error)
    }
    for (;;) {
      if (likely(!__pyx_t_12)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_13 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_13); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1777, __pyx_L46_error)
          #else
          __pyx_t_13 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1777, __pyx_L46_error)
          __Pyx_GOTREF(__pyx_t_13);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_13); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1777, __pyx_L46_error)
          #else
          __pyx_t_13 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1777, __pyx_L46_error)
          __Pyx_GOTREF(__pyx_t_13);
          #endif
        }
      } else {
        __pyx_t_13 = __pyx_t_12(__pyx_t_5);
        if (unlikely(!__pyx_t_13)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1777, __pyx_L46_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_13);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr34__pyx_v_leaf, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "mathics/core/expression.py":1776
 *             self._head.replace_vars(vars, options=options, in_scoping=in_scoping),
 *             *[
 *                 leaf.replace_vars(vars, options=options, in_scoping=in_scoping)             # <<<<<<<<<<<<<<
 *                 for leaf in leaves
 *             ]
 */
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr34__pyx_v_leaf, __pyx_n_s_replace_vars); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1776, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1776, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_vars);
      __Pyx_GIVEREF(__pyx_v_vars);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_vars);
      __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1776, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_15);
      if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_options, __pyx_v_options) < 0) __PYX_ERR(0, 1776, __pyx_L46_error)
      if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_in_scoping, __pyx_v_in_scoping) < 0) __PYX_ERR(0, 1776, __pyx_L46_error)
      __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_10, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1776, __pyx_L46_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_14, (PyObject*)__pyx_t_16))) __PYX_ERR(0, 1775, __pyx_L46_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

      /* "mathics/core/expression.py":1777
 *             *[
 *                 leaf.replace_vars(vars, options=options, in_scoping=in_scoping)
 *                 for leaf in leaves             # <<<<<<<<<<<<<<
 *             ]
 *         )
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_9genexpr34__pyx_v_leaf); __pyx_9genexpr34__pyx_v_leaf = 0;
    goto __pyx_L49_exit_scope;
    __pyx_L46_error:;
    __Pyx_XDECREF(__pyx_9genexpr34__pyx_v_leaf); __pyx_9genexpr34__pyx_v_leaf = 0;
    goto __pyx_L1_error;
    __pyx_L49_exit_scope:;
  } /* exit inner scope */

  /* "mathics/core/expression.py":1773
 *             return self.shallow_copy()
 * 
 *         return Expression(             # <<<<<<<<<<<<<<
 *             self._head.replace_vars(vars, options=options, in_scoping=in_scoping),
 *             *[
 */
  __pyx_t_5 = PySequence_Tuple(__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1726
 *             return expr, new_applied[0]
 * 
 *     def replace_vars(             # <<<<<<<<<<<<<<
 *         self, vars, options=None, in_scoping=True, in_function=True
 *     ) -> "Expression":
 */

  /* 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_10);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("mathics.core.expression.Expression.replace_vars", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_scoping_vars);
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_v_func_params);
  __Pyx_XDECREF(__pyx_v_body);
  __Pyx_XDECREF(__pyx_v_replacement);
  __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_var);
  __Pyx_XDECREF(__pyx_9genexpr30__pyx_v_value);
  __Pyx_XDECREF(__pyx_9genexpr31__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_9genexpr32__pyx_v_name);
  __Pyx_XDECREF(__pyx_9genexpr33__pyx_v_name);
  __Pyx_XDECREF(__pyx_9genexpr34__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_v_vars);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1781
 *         )
 * 
 *     def replace_slots(self, slots, evaluation):             # <<<<<<<<<<<<<<
 *         if self._head.get_name() == "System`Slot":
 *             if len(self._leaves) != 1:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_103replace_slots(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_103replace_slots = {"replace_slots", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_103replace_slots, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_103replace_slots(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_slots = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace_slots (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_slots,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_slots)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace_slots", 1, 3, 3, 1); __PYX_ERR(0, 1781, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace_slots", 1, 3, 3, 2); __PYX_ERR(0, 1781, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace_slots") < 0)) __PYX_ERR(0, 1781, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_slots = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace_slots", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1781, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.replace_slots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_102replace_slots(__pyx_self, __pyx_v_self, __pyx_v_slots, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_102replace_slots(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_slots, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_slot = NULL;
  PyObject *__pyx_9genexpr35__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace_slots", 0);

  /* "mathics/core/expression.py":1782
 * 
 *     def replace_slots(self, slots, evaluation):
 *         if self._head.get_name() == "System`Slot":             # <<<<<<<<<<<<<<
 *             if len(self._leaves) != 1:
 *                 evaluation.message_args("Slot", len(self._leaves), 1)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_Slot, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1782, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1783
 *     def replace_slots(self, slots, evaluation):
 *         if self._head.get_name() == "System`Slot":
 *             if len(self._leaves) != 1:             # <<<<<<<<<<<<<<
 *                 evaluation.message_args("Slot", len(self._leaves), 1)
 *             else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1783, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = ((__pyx_t_5 != 1) != 0);
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":1784
 *         if self._head.get_name() == "System`Slot":
 *             if len(self._leaves) != 1:
 *                 evaluation.message_args("Slot", len(self._leaves), 1)             # <<<<<<<<<<<<<<
 *             else:
 *                 slot = self._leaves[0].get_int_value()
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1784, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1784, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1784, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1784, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_Slot, __pyx_t_2, __pyx_int_1};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1784, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_Slot, __pyx_t_2, __pyx_int_1};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1784, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1784, __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_n_u_Slot);
        __Pyx_GIVEREF(__pyx_n_u_Slot);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_n_u_Slot);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_2);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_int_1);
        __pyx_t_2 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1784, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/core/expression.py":1783
 *     def replace_slots(self, slots, evaluation):
 *         if self._head.get_name() == "System`Slot":
 *             if len(self._leaves) != 1:             # <<<<<<<<<<<<<<
 *                 evaluation.message_args("Slot", len(self._leaves), 1)
 *             else:
 */
      goto __pyx_L4;
    }

    /* "mathics/core/expression.py":1786
 *                 evaluation.message_args("Slot", len(self._leaves), 1)
 *             else:
 *                 slot = self._leaves[0].get_int_value()             # <<<<<<<<<<<<<<
 *                 if slot is None or slot < 0:
 *                     evaluation.message("Function", "slot", self._leaves[0])
 */
    /*else*/ {
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1786, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1786, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1786, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1786, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_slot = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "mathics/core/expression.py":1787
 *             else:
 *                 slot = self._leaves[0].get_int_value()
 *                 if slot is None or slot < 0:             # <<<<<<<<<<<<<<
 *                     evaluation.message("Function", "slot", self._leaves[0])
 *                 elif slot > len(slots) - 1:
 */
      __pyx_t_9 = (__pyx_v_slot == Py_None);
      __pyx_t_10 = (__pyx_t_9 != 0);
      if (!__pyx_t_10) {
      } else {
        __pyx_t_4 = __pyx_t_10;
        goto __pyx_L6_bool_binop_done;
      }
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_slot, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1787, __pyx_L1_error)
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1787, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __pyx_t_10;
      __pyx_L6_bool_binop_done:;
      if (__pyx_t_4) {

        /* "mathics/core/expression.py":1788
 *                 slot = self._leaves[0].get_int_value()
 *                 if slot is None or slot < 0:
 *                     evaluation.message("Function", "slot", self._leaves[0])             # <<<<<<<<<<<<<<
 *                 elif slot > len(slots) - 1:
 *                     evaluation.message("Function", "slotn", slot)
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1788, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1788, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1788, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && likely(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_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_n_u_Function, __pyx_n_u_slot, __pyx_t_2};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1788, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_n_u_Function, __pyx_n_u_slot, __pyx_t_2};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1788, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1788, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_8) {
            __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
          }
          __Pyx_INCREF(__pyx_n_u_Function);
          __Pyx_GIVEREF(__pyx_n_u_Function);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_n_u_Function);
          __Pyx_INCREF(__pyx_n_u_slot);
          __Pyx_GIVEREF(__pyx_n_u_slot);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_n_u_slot);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1788, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "mathics/core/expression.py":1787
 *             else:
 *                 slot = self._leaves[0].get_int_value()
 *                 if slot is None or slot < 0:             # <<<<<<<<<<<<<<
 *                     evaluation.message("Function", "slot", self._leaves[0])
 *                 elif slot > len(slots) - 1:
 */
        goto __pyx_L5;
      }

      /* "mathics/core/expression.py":1789
 *                 if slot is None or slot < 0:
 *                     evaluation.message("Function", "slot", self._leaves[0])
 *                 elif slot > len(slots) - 1:             # <<<<<<<<<<<<<<
 *                     evaluation.message("Function", "slotn", slot)
 *                 else:
 */
      __pyx_t_5 = PyObject_Length(__pyx_v_slots); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1789, __pyx_L1_error)
      __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_5 - 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1789, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_slot, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1789, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1789, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_4) {

        /* "mathics/core/expression.py":1790
 *                     evaluation.message("Function", "slot", self._leaves[0])
 *                 elif slot > len(slots) - 1:
 *                     evaluation.message("Function", "slotn", slot)             # <<<<<<<<<<<<<<
 *                 else:
 *                     return slots[int(slot)]
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1790, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_Function, __pyx_n_u_slotn, __pyx_v_slot};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1790, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_Function, __pyx_n_u_slotn, __pyx_v_slot};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1790, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1790, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_INCREF(__pyx_n_u_Function);
          __Pyx_GIVEREF(__pyx_n_u_Function);
          PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_n_u_Function);
          __Pyx_INCREF(__pyx_n_u_slotn);
          __Pyx_GIVEREF(__pyx_n_u_slotn);
          PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_n_u_slotn);
          __Pyx_INCREF(__pyx_v_slot);
          __Pyx_GIVEREF(__pyx_v_slot);
          PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_7, __pyx_v_slot);
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1790, __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;

        /* "mathics/core/expression.py":1789
 *                 if slot is None or slot < 0:
 *                     evaluation.message("Function", "slot", self._leaves[0])
 *                 elif slot > len(slots) - 1:             # <<<<<<<<<<<<<<
 *                     evaluation.message("Function", "slotn", slot)
 *                 else:
 */
        goto __pyx_L5;
      }

      /* "mathics/core/expression.py":1792
 *                     evaluation.message("Function", "slotn", slot)
 *                 else:
 *                     return slots[int(slot)]             # <<<<<<<<<<<<<<
 *         elif self._head.get_name() == "System`SlotSequence":
 *             if len(self._leaves) != 1:
 */
      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_slot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1792, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_slots, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1792, __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;
      }
      __pyx_L5:;
    }
    __pyx_L4:;

    /* "mathics/core/expression.py":1782
 * 
 *     def replace_slots(self, slots, evaluation):
 *         if self._head.get_name() == "System`Slot":             # <<<<<<<<<<<<<<
 *             if len(self._leaves) != 1:
 *                 evaluation.message_args("Slot", len(self._leaves), 1)
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":1793
 *                 else:
 *                     return slots[int(slot)]
 *         elif self._head.get_name() == "System`SlotSequence":             # <<<<<<<<<<<<<<
 *             if len(self._leaves) != 1:
 *                 evaluation.message_args("SlotSequence", len(self._leaves), 1)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1793, __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, 1793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_SlotSequence, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1794
 *                     return slots[int(slot)]
 *         elif self._head.get_name() == "System`SlotSequence":
 *             if len(self._leaves) != 1:             # <<<<<<<<<<<<<<
 *                 evaluation.message_args("SlotSequence", len(self._leaves), 1)
 *             else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1794, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = ((__pyx_t_5 != 1) != 0);
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":1795
 *         elif self._head.get_name() == "System`SlotSequence":
 *             if len(self._leaves) != 1:
 *                 evaluation.message_args("SlotSequence", len(self._leaves), 1)             # <<<<<<<<<<<<<<
 *             else:
 *                 slot = self._leaves[0].get_int_value()
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1795, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1795, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1795, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1795, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_SlotSequence, __pyx_t_3, __pyx_int_1};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1795, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_SlotSequence, __pyx_t_3, __pyx_int_1};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1795, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1795, __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_n_u_SlotSequence);
        __Pyx_GIVEREF(__pyx_n_u_SlotSequence);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_n_u_SlotSequence);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_int_1);
        __pyx_t_3 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1795, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/core/expression.py":1794
 *                     return slots[int(slot)]
 *         elif self._head.get_name() == "System`SlotSequence":
 *             if len(self._leaves) != 1:             # <<<<<<<<<<<<<<
 *                 evaluation.message_args("SlotSequence", len(self._leaves), 1)
 *             else:
 */
      goto __pyx_L8;
    }

    /* "mathics/core/expression.py":1797
 *                 evaluation.message_args("SlotSequence", len(self._leaves), 1)
 *             else:
 *                 slot = self._leaves[0].get_int_value()             # <<<<<<<<<<<<<<
 *                 if slot is None or slot < 1:
 *                     evaluation.error("Function", "slot", self._leaves[0])
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1797, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1797, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1797, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1797, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_slot = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "mathics/core/expression.py":1798
 *             else:
 *                 slot = self._leaves[0].get_int_value()
 *                 if slot is None or slot < 1:             # <<<<<<<<<<<<<<
 *                     evaluation.error("Function", "slot", self._leaves[0])
 *             return Expression(SymbolSequence, *slots[slot:])
 */
      __pyx_t_10 = (__pyx_v_slot == Py_None);
      __pyx_t_9 = (__pyx_t_10 != 0);
      if (!__pyx_t_9) {
      } else {
        __pyx_t_4 = __pyx_t_9;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_slot, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1798, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1798, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __pyx_t_9;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_4) {

        /* "mathics/core/expression.py":1799
 *                 slot = self._leaves[0].get_int_value()
 *                 if slot is None or slot < 1:
 *                     evaluation.error("Function", "slot", self._leaves[0])             # <<<<<<<<<<<<<<
 *             return Expression(SymbolSequence, *slots[slot:])
 *         elif self._head.get_name() == "System`Function" and len(self._leaves) == 1:
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1799, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1799, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1799, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_n_u_Function, __pyx_n_u_slot, __pyx_t_3};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1799, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_n_u_Function, __pyx_n_u_slot, __pyx_t_3};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1799, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1799, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_8) {
            __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
          }
          __Pyx_INCREF(__pyx_n_u_Function);
          __Pyx_GIVEREF(__pyx_n_u_Function);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_n_u_Function);
          __Pyx_INCREF(__pyx_n_u_slot);
          __Pyx_GIVEREF(__pyx_n_u_slot);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_n_u_slot);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1799, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "mathics/core/expression.py":1798
 *             else:
 *                 slot = self._leaves[0].get_int_value()
 *                 if slot is None or slot < 1:             # <<<<<<<<<<<<<<
 *                     evaluation.error("Function", "slot", self._leaves[0])
 *             return Expression(SymbolSequence, *slots[slot:])
 */
      }
    }
    __pyx_L8:;

    /* "mathics/core/expression.py":1800
 *                 if slot is None or slot < 1:
 *                     evaluation.error("Function", "slot", self._leaves[0])
 *             return Expression(SymbolSequence, *slots[slot:])             # <<<<<<<<<<<<<<
 *         elif self._head.get_name() == "System`Function" and len(self._leaves) == 1:
 *             # do not replace Slots in nested Functions
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SymbolSequence); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    if (unlikely(!__pyx_v_slot)) { __Pyx_RaiseUnboundLocalError("slot"); __PYX_ERR(0, 1800, __pyx_L1_error) }
    __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_slots, 0, 0, &__pyx_v_slot, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1800, __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, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1800, __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_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1793
 *                 else:
 *                     return slots[int(slot)]
 *         elif self._head.get_name() == "System`SlotSequence":             # <<<<<<<<<<<<<<
 *             if len(self._leaves) != 1:
 *                 evaluation.message_args("SlotSequence", len(self._leaves), 1)
 */
  }

  /* "mathics/core/expression.py":1801
 *                     evaluation.error("Function", "slot", self._leaves[0])
 *             return Expression(SymbolSequence, *slots[slot:])
 *         elif self._head.get_name() == "System`Function" and len(self._leaves) == 1:             # <<<<<<<<<<<<<<
 *             # do not replace Slots in nested Functions
 *             return self
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_kp_u_System_Function, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1801, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_9) {
  } else {
    __pyx_t_4 = __pyx_t_9;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1801, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = ((__pyx_t_5 == 1) != 0);
  __pyx_t_4 = __pyx_t_9;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1803
 *         elif self._head.get_name() == "System`Function" and len(self._leaves) == 1:
 *             # do not replace Slots in nested Functions
 *             return self             # <<<<<<<<<<<<<<
 *         return Expression(
 *             self._head.replace_slots(slots, evaluation),
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1801
 *                     evaluation.error("Function", "slot", self._leaves[0])
 *             return Expression(SymbolSequence, *slots[slot:])
 *         elif self._head.get_name() == "System`Function" and len(self._leaves) == 1:             # <<<<<<<<<<<<<<
 *             # do not replace Slots in nested Functions
 *             return self
 */
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":1804
 *             # do not replace Slots in nested Functions
 *             return self
 *         return Expression(             # <<<<<<<<<<<<<<
 *             self._head.replace_slots(slots, evaluation),
 *             *[leaf.replace_slots(slots, evaluation) for leaf in self._leaves]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/core/expression.py":1805
 *             return self
 *         return Expression(
 *             self._head.replace_slots(slots, evaluation),             # <<<<<<<<<<<<<<
 *             *[leaf.replace_slots(slots, evaluation) for leaf in self._leaves]
 *         )
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_replace_slots); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_slots, __pyx_v_evaluation};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1805, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_slots, __pyx_v_evaluation};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1805, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_slots);
    __Pyx_GIVEREF(__pyx_v_slots);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_slots);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_evaluation);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":1804
 *             # do not replace Slots in nested Functions
 *             return self
 *         return Expression(             # <<<<<<<<<<<<<<
 *             self._head.replace_slots(slots, evaluation),
 *             *[leaf.replace_slots(slots, evaluation) for leaf in self._leaves]
 */
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  { /* enter inner scope */

    /* "mathics/core/expression.py":1806
 *         return Expression(
 *             self._head.replace_slots(slots, evaluation),
 *             *[leaf.replace_slots(slots, evaluation) for leaf in self._leaves]             # <<<<<<<<<<<<<<
 *         )
 * 
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1806, __pyx_L16_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1806, __pyx_L16_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
      __pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1806, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1806, __pyx_L16_error)
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    for (;;) {
      if (likely(!__pyx_t_11)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_8); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1806, __pyx_L16_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1806, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_8); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1806, __pyx_L16_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1806, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_11(__pyx_t_2);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1806, __pyx_L16_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr35__pyx_v_leaf, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_9genexpr35__pyx_v_leaf, __pyx_n_s_replace_slots); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1806, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_slots, __pyx_v_evaluation};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1806, __pyx_L16_error)
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_slots, __pyx_v_evaluation};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1806, __pyx_L16_error)
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1806, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (__pyx_t_13) {
          __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
        }
        __Pyx_INCREF(__pyx_v_slots);
        __Pyx_GIVEREF(__pyx_v_slots);
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_7, __pyx_v_slots);
        __Pyx_INCREF(__pyx_v_evaluation);
        __Pyx_GIVEREF(__pyx_v_evaluation);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_7, __pyx_v_evaluation);
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1806, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 1806, __pyx_L16_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_9genexpr35__pyx_v_leaf); __pyx_9genexpr35__pyx_v_leaf = 0;
    goto __pyx_L19_exit_scope;
    __pyx_L16_error:;
    __Pyx_XDECREF(__pyx_9genexpr35__pyx_v_leaf); __pyx_9genexpr35__pyx_v_leaf = 0;
    goto __pyx_L1_error;
    __pyx_L19_exit_scope:;
  } /* exit inner scope */

  /* "mathics/core/expression.py":1804
 *             # do not replace Slots in nested Functions
 *             return self
 *         return Expression(             # <<<<<<<<<<<<<<
 *             self._head.replace_slots(slots, evaluation),
 *             *[leaf.replace_slots(slots, evaluation) for leaf in self._leaves]
 */
  __pyx_t_2 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1804, __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;

  /* "mathics/core/expression.py":1781
 *         )
 * 
 *     def replace_slots(self, slots, evaluation):             # <<<<<<<<<<<<<<
 *         if self._head.get_name() == "System`Slot":
 *             if len(self._leaves) != 1:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("mathics.core.expression.Expression.replace_slots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_slot);
  __Pyx_XDECREF(__pyx_9genexpr35__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1809
 *         )
 * 
 *     def thread(self, evaluation, head=None) -> typing.Tuple[bool, "Expression"]:             # <<<<<<<<<<<<<<
 *         if head is None:
 *             head = Symbol("List")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_105thread(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_105thread = {"thread", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_105thread, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_105thread(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_head = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("thread (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_head,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("thread", 0, 2, 3, 1); __PYX_ERR(0, 1809, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_head);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "thread") < 0)) __PYX_ERR(0, 1809, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_head = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("thread", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1809, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.thread", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_104thread(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_head);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_104thread(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_head) {
  PyObject *__pyx_v_items = NULL;
  PyObject *__pyx_v_dim = NULL;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_item = NULL;
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_9genexpr36__pyx_v_innerleaf = NULL;
  PyObject *__pyx_9genexpr37__pyx_v_item = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("thread", 0);
  __Pyx_INCREF(__pyx_v_head);

  /* "mathics/core/expression.py":1810
 * 
 *     def thread(self, evaluation, head=None) -> typing.Tuple[bool, "Expression"]:
 *         if head is None:             # <<<<<<<<<<<<<<
 *             head = Symbol("List")
 * 
 */
  __pyx_t_1 = (__pyx_v_head == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":1811
 *     def thread(self, evaluation, head=None) -> typing.Tuple[bool, "Expression"]:
 *         if head is None:
 *             head = Symbol("List")             # <<<<<<<<<<<<<<
 * 
 *         items = []
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_u_List) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_u_List);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_head, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":1810
 * 
 *     def thread(self, evaluation, head=None) -> typing.Tuple[bool, "Expression"]:
 *         if head is None:             # <<<<<<<<<<<<<<
 *             head = Symbol("List")
 * 
 */
  }

  /* "mathics/core/expression.py":1813
 *             head = Symbol("List")
 * 
 *         items = []             # <<<<<<<<<<<<<<
 *         dim = None
 *         for leaf in self._leaves:
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_items = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "mathics/core/expression.py":1814
 * 
 *         items = []
 *         dim = None             # <<<<<<<<<<<<<<
 *         for leaf in self._leaves:
 *             if leaf.get_head().sameQ(head):
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_dim = Py_None;

  /* "mathics/core/expression.py":1815
 *         items = []
 *         dim = None
 *         for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *             if leaf.get_head().sameQ(head):
 *                 if dim is None:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1815, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1815, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1815, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1815, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1815, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1815, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_7(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1815, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":1816
 *         dim = None
 *         for leaf in self._leaves:
 *             if leaf.get_head().sameQ(head):             # <<<<<<<<<<<<<<
 *                 if dim is None:
 *                     dim = len(leaf._leaves)
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_get_head); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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_5 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_5, __pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_head);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1816, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "mathics/core/expression.py":1817
 *         for leaf in self._leaves:
 *             if leaf.get_head().sameQ(head):
 *                 if dim is None:             # <<<<<<<<<<<<<<
 *                     dim = len(leaf._leaves)
 *                     items = [(items + [innerleaf]) for innerleaf in leaf._leaves]
 */
      __pyx_t_2 = (__pyx_v_dim == Py_None);
      __pyx_t_1 = (__pyx_t_2 != 0);
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":1818
 *             if leaf.get_head().sameQ(head):
 *                 if dim is None:
 *                     dim = len(leaf._leaves)             # <<<<<<<<<<<<<<
 *                     items = [(items + [innerleaf]) for innerleaf in leaf._leaves]
 *                 elif len(leaf._leaves) != dim:
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1818, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_10 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1818, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1818, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF_SET(__pyx_v_dim, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "mathics/core/expression.py":1819
 *                 if dim is None:
 *                     dim = len(leaf._leaves)
 *                     items = [(items + [innerleaf]) for innerleaf in leaf._leaves]             # <<<<<<<<<<<<<<
 *                 elif len(leaf._leaves) != dim:
 *                     evaluation.message("Thread", "tdlen")
 */
        { /* enter inner scope */
          __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1819, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1819, __pyx_L10_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
            __pyx_t_5 = __pyx_t_8; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0;
            __pyx_t_11 = NULL;
          } else {
            __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1819, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1819, __pyx_L10_error)
          }
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          for (;;) {
            if (likely(!__pyx_t_11)) {
              if (likely(PyList_CheckExact(__pyx_t_5))) {
                if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1819, __pyx_L10_error)
                #else
                __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1819, __pyx_L10_error)
                __Pyx_GOTREF(__pyx_t_8);
                #endif
              } else {
                if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1819, __pyx_L10_error)
                #else
                __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1819, __pyx_L10_error)
                __Pyx_GOTREF(__pyx_t_8);
                #endif
              }
            } else {
              __pyx_t_8 = __pyx_t_11(__pyx_t_5);
              if (unlikely(!__pyx_t_8)) {
                PyObject* exc_type = PyErr_Occurred();
                if (exc_type) {
                  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                  else __PYX_ERR(0, 1819, __pyx_L10_error)
                }
                break;
              }
              __Pyx_GOTREF(__pyx_t_8);
            }
            __Pyx_XDECREF_SET(__pyx_9genexpr36__pyx_v_innerleaf, __pyx_t_8);
            __pyx_t_8 = 0;
            __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1819, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_INCREF(__pyx_9genexpr36__pyx_v_innerleaf);
            __Pyx_GIVEREF(__pyx_9genexpr36__pyx_v_innerleaf);
            PyList_SET_ITEM(__pyx_t_8, 0, __pyx_9genexpr36__pyx_v_innerleaf);
            __pyx_t_9 = PyNumber_Add(__pyx_v_items, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1819, __pyx_L10_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 1819, __pyx_L10_error)
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_9genexpr36__pyx_v_innerleaf); __pyx_9genexpr36__pyx_v_innerleaf = 0;
          goto __pyx_L13_exit_scope;
          __pyx_L10_error:;
          __Pyx_XDECREF(__pyx_9genexpr36__pyx_v_innerleaf); __pyx_9genexpr36__pyx_v_innerleaf = 0;
          goto __pyx_L1_error;
          __pyx_L13_exit_scope:;
        } /* exit inner scope */
        __Pyx_DECREF_SET(__pyx_v_items, ((PyObject*)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "mathics/core/expression.py":1817
 *         for leaf in self._leaves:
 *             if leaf.get_head().sameQ(head):
 *                 if dim is None:             # <<<<<<<<<<<<<<
 *                     dim = len(leaf._leaves)
 *                     items = [(items + [innerleaf]) for innerleaf in leaf._leaves]
 */
        goto __pyx_L7;
      }

      /* "mathics/core/expression.py":1820
 *                     dim = len(leaf._leaves)
 *                     items = [(items + [innerleaf]) for innerleaf in leaf._leaves]
 *                 elif len(leaf._leaves) != dim:             # <<<<<<<<<<<<<<
 *                     evaluation.message("Thread", "tdlen")
 *                     return True, self
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1820, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_v_dim, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1820, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1820, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":1821
 *                     items = [(items + [innerleaf]) for innerleaf in leaf._leaves]
 *                 elif len(leaf._leaves) != dim:
 *                     evaluation.message("Thread", "tdlen")             # <<<<<<<<<<<<<<
 *                     return True, self
 *                 else:
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1821, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__67, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1821, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "mathics/core/expression.py":1822
 *                 elif len(leaf._leaves) != dim:
 *                     evaluation.message("Thread", "tdlen")
 *                     return True, self             # <<<<<<<<<<<<<<
 *                 else:
 *                     for index in range(dim):
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1822, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(Py_True);
        __Pyx_GIVEREF(Py_True);
        PyTuple_SET_ITEM(__pyx_t_3, 0, Py_True);
        __Pyx_INCREF(__pyx_v_self);
        __Pyx_GIVEREF(__pyx_v_self);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self);
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":1820
 *                     dim = len(leaf._leaves)
 *                     items = [(items + [innerleaf]) for innerleaf in leaf._leaves]
 *                 elif len(leaf._leaves) != dim:             # <<<<<<<<<<<<<<
 *                     evaluation.message("Thread", "tdlen")
 *                     return True, self
 */
      }

      /* "mathics/core/expression.py":1824
 *                     return True, self
 *                 else:
 *                     for index in range(dim):             # <<<<<<<<<<<<<<
 *                         items[index].append(leaf._leaves[index])
 *             else:
 */
      /*else*/ {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1824, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
          __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0;
          __pyx_t_11 = NULL;
        } else {
          __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1824, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1824, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        for (;;) {
          if (likely(!__pyx_t_11)) {
            if (likely(PyList_CheckExact(__pyx_t_5))) {
              if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1824, __pyx_L1_error)
              #else
              __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1824, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              #endif
            } else {
              if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1824, __pyx_L1_error)
              #else
              __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1824, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              #endif
            }
          } else {
            __pyx_t_3 = __pyx_t_11(__pyx_t_5);
            if (unlikely(!__pyx_t_3)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 1824, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_3);
          }
          __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_3);
          __pyx_t_3 = 0;

          /* "mathics/core/expression.py":1825
 *                 else:
 *                     for index in range(dim):
 *                         items[index].append(leaf._leaves[index])             # <<<<<<<<<<<<<<
 *             else:
 *                 if dim is None:
 */
          __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_items, __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1825, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1825, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_9, __pyx_v_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1825, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_12 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_t_8); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 1825, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "mathics/core/expression.py":1824
 *                     return True, self
 *                 else:
 *                     for index in range(dim):             # <<<<<<<<<<<<<<
 *                         items[index].append(leaf._leaves[index])
 *             else:
 */
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_L7:;

      /* "mathics/core/expression.py":1816
 *         dim = None
 *         for leaf in self._leaves:
 *             if leaf.get_head().sameQ(head):             # <<<<<<<<<<<<<<
 *                 if dim is None:
 *                     dim = len(leaf._leaves)
 */
      goto __pyx_L6;
    }

    /* "mathics/core/expression.py":1827
 *                         items[index].append(leaf._leaves[index])
 *             else:
 *                 if dim is None:             # <<<<<<<<<<<<<<
 *                     items.append(leaf)
 *                 else:
 */
    /*else*/ {
      __pyx_t_1 = (__pyx_v_dim == Py_None);
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {

        /* "mathics/core/expression.py":1828
 *             else:
 *                 if dim is None:
 *                     items.append(leaf)             # <<<<<<<<<<<<<<
 *                 else:
 *                     for item in items:
 */
        __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_items, __pyx_v_leaf); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 1828, __pyx_L1_error)

        /* "mathics/core/expression.py":1827
 *                         items[index].append(leaf._leaves[index])
 *             else:
 *                 if dim is None:             # <<<<<<<<<<<<<<
 *                     items.append(leaf)
 *                 else:
 */
        goto __pyx_L16;
      }

      /* "mathics/core/expression.py":1830
 *                     items.append(leaf)
 *                 else:
 *                     for item in items:             # <<<<<<<<<<<<<<
 *                         item.append(leaf)
 *         if dim is None:
 */
      /*else*/ {
        __pyx_t_5 = __pyx_v_items; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0;
        for (;;) {
          if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_8); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1830, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1830, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_8);
          __pyx_t_8 = 0;

          /* "mathics/core/expression.py":1831
 *                 else:
 *                     for item in items:
 *                         item.append(leaf)             # <<<<<<<<<<<<<<
 *         if dim is None:
 *             return False, self
 */
          __pyx_t_12 = __Pyx_PyObject_Append(__pyx_v_item, __pyx_v_leaf); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 1831, __pyx_L1_error)

          /* "mathics/core/expression.py":1830
 *                     items.append(leaf)
 *                 else:
 *                     for item in items:             # <<<<<<<<<<<<<<
 *                         item.append(leaf)
 *         if dim is None:
 */
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __pyx_L16:;
    }
    __pyx_L6:;

    /* "mathics/core/expression.py":1815
 *         items = []
 *         dim = None
 *         for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *             if leaf.get_head().sameQ(head):
 *                 if dim is None:
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1832
 *                     for item in items:
 *                         item.append(leaf)
 *         if dim is None:             # <<<<<<<<<<<<<<
 *             return False, self
 *         else:
 */
  __pyx_t_2 = (__pyx_v_dim == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":1833
 *                         item.append(leaf)
 *         if dim is None:
 *             return False, self             # <<<<<<<<<<<<<<
 *         else:
 *             leaves = [Expression(self._head, *item) for item in items]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(Py_False);
    __Pyx_GIVEREF(Py_False);
    PyTuple_SET_ITEM(__pyx_t_4, 0, Py_False);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1832
 *                     for item in items:
 *                         item.append(leaf)
 *         if dim is None:             # <<<<<<<<<<<<<<
 *             return False, self
 *         else:
 */
  }

  /* "mathics/core/expression.py":1835
 *             return False, self
 *         else:
 *             leaves = [Expression(self._head, *item) for item in items]             # <<<<<<<<<<<<<<
 *             return True, Expression(head, *leaves)
 * 
 */
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1835, __pyx_L22_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __pyx_v_items; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
      for (;;) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1835, __pyx_L22_error)
        #else
        __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1835, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_8);
        #endif
        __Pyx_XDECREF_SET(__pyx_9genexpr37__pyx_v_item, __pyx_t_8);
        __pyx_t_8 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Expression); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1835, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1835, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1835, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_9genexpr37__pyx_v_item); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1835, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_13 = PyNumber_Add(__pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1835, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1835, __pyx_L22_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1835, __pyx_L22_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_9genexpr37__pyx_v_item); __pyx_9genexpr37__pyx_v_item = 0;
      goto __pyx_L25_exit_scope;
      __pyx_L22_error:;
      __Pyx_XDECREF(__pyx_9genexpr37__pyx_v_item); __pyx_9genexpr37__pyx_v_item = 0;
      goto __pyx_L1_error;
      __pyx_L25_exit_scope:;
    } /* exit inner scope */
    __pyx_v_leaves = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":1836
 *         else:
 *             leaves = [Expression(self._head, *item) for item in items]
 *             return True, Expression(head, *leaves)             # <<<<<<<<<<<<<<
 * 
 *     def is_numeric(self) -> bool:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_head);
    __Pyx_GIVEREF(__pyx_v_head);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_head);
    __pyx_t_3 = PySequence_Tuple(__pyx_v_leaves); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_13 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_INCREF(Py_True);
    __Pyx_GIVEREF(Py_True);
    PyTuple_SET_ITEM(__pyx_t_13, 0, Py_True);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_13;
    __pyx_t_13 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":1809
 *         )
 * 
 *     def thread(self, evaluation, head=None) -> typing.Tuple[bool, "Expression"]:             # <<<<<<<<<<<<<<
 *         if head is None:
 *             head = Symbol("List")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("mathics.core.expression.Expression.thread", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_v_dim);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_9genexpr36__pyx_v_innerleaf);
  __Pyx_XDECREF(__pyx_9genexpr37__pyx_v_item);
  __Pyx_XDECREF(__pyx_v_head);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1838
 *             return True, Expression(head, *leaves)
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             self._head.get_name()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_107is_numeric(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_107is_numeric = {"is_numeric", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_107is_numeric, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_107is_numeric(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_numeric (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_106is_numeric(__pyx_self, ((PyObject *)__pyx_v_self));

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

/* "mathics/core/expression.py":1852
 *                 "Sin",
 *             )
 *             and all(leaf.is_numeric() for leaf in self._leaves)             # <<<<<<<<<<<<<<
 *         )
 *         # TODO: complete list of numeric functions, or access NumericFunction
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_10is_numeric_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_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_7mathics_4core_10expression___pyx_scope_struct_26_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_26_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_26_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1852, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *) __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_7mathics_4core_10expression_10Expression_10is_numeric_2generator12, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Expression_is_numeric_locals_gen, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 1852, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.is_numeric.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_7mathics_4core_10expression_10Expression_10is_numeric_2generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1852, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 1852, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1852, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1852, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1852, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1852, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1852, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1852, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_leaf);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_leaf, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_leaf, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1852, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1852, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = ((!__pyx_t_7) != 0);
    if (__pyx_t_8) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

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

/* "mathics/core/expression.py":1838
 *             return True, Expression(head, *leaves)
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             self._head.get_name()
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_106is_numeric(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_numeric", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1838, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);

  /* "mathics/core/expression.py":1839
 * 
 *     def is_numeric(self) -> bool:
 *         return (             # <<<<<<<<<<<<<<
 *             self._head.get_name()
 *             in system_symbols(
 */
  __Pyx_XDECREF(__pyx_r);

  /* "mathics/core/expression.py":1840
 *     def is_numeric(self) -> bool:
 *         return (
 *             self._head.get_name()             # <<<<<<<<<<<<<<
 *             in system_symbols(
 *                 "Sqrt",
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1841
 *         return (
 *             self._head.get_name()
 *             in system_symbols(             # <<<<<<<<<<<<<<
 *                 "Sqrt",
 *                 "Times",
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_system_symbols); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__68, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1841, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":1852
 *                 "Sin",
 *             )
 *             and all(leaf.is_numeric() for leaf in self._leaves)             # <<<<<<<<<<<<<<
 *         )
 *         # TODO: complete list of numeric functions, or access NumericFunction
 */
  __pyx_t_3 = __pyx_pf_7mathics_4core_10expression_10Expression_10is_numeric_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1838
 *             return True, Expression(head, *leaves)
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             self._head.get_name()
 */

  /* 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("mathics.core.expression.Expression.is_numeric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1857
 *         # attribute
 * 
 *     def numerify(self, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         _prec = None
 *         for leaf in self._leaves:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_109numerify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_109numerify = {"numerify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_109numerify, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_109numerify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numerify (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("numerify", 1, 2, 2, 1); __PYX_ERR(0, 1857, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "numerify") < 0)) __PYX_ERR(0, 1857, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("numerify", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1857, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.numerify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_108numerify(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_108numerify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v__prec = NULL;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_v_leaf_prec = NULL;
  PyObject *__pyx_v_new_leaves = NULL;
  Py_ssize_t __pyx_v_index;
  PyObject *__pyx_v_n_expr = NULL;
  PyObject *__pyx_v_n_result = 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;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("numerify", 0);

  /* "mathics/core/expression.py":1858
 * 
 *     def numerify(self, evaluation) -> "Expression":
 *         _prec = None             # <<<<<<<<<<<<<<
 *         for leaf in self._leaves:
 *             if leaf.is_inexact():
 */
  __Pyx_INCREF(Py_None);
  __pyx_v__prec = Py_None;

  /* "mathics/core/expression.py":1859
 *     def numerify(self, evaluation) -> "Expression":
 *         _prec = None
 *         for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *             if leaf.is_inexact():
 *                 leaf_prec = leaf.get_precision()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1859, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1859, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1859, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1859, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1859, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1859, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1859, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1860
 *         _prec = None
 *         for leaf in self._leaves:
 *             if leaf.is_inexact():             # <<<<<<<<<<<<<<
 *                 leaf_prec = leaf.get_precision()
 *                 if _prec is None or leaf_prec < _prec:
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_is_inexact); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":1861
 *         for leaf in self._leaves:
 *             if leaf.is_inexact():
 *                 leaf_prec = leaf.get_precision()             # <<<<<<<<<<<<<<
 *                 if _prec is None or leaf_prec < _prec:
 *                     _prec = leaf_prec
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_leaf_prec, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/core/expression.py":1862
 *             if leaf.is_inexact():
 *                 leaf_prec = leaf.get_precision()
 *                 if _prec is None or leaf_prec < _prec:             # <<<<<<<<<<<<<<
 *                     _prec = leaf_prec
 *         if _prec is not None:
 */
      __pyx_t_8 = (__pyx_v__prec == Py_None);
      __pyx_t_9 = (__pyx_t_8 != 0);
      if (!__pyx_t_9) {
      } else {
        __pyx_t_7 = __pyx_t_9;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_leaf_prec, __pyx_v__prec, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1862, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1862, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_7 = __pyx_t_9;
      __pyx_L7_bool_binop_done:;
      if (__pyx_t_7) {

        /* "mathics/core/expression.py":1863
 *                 leaf_prec = leaf.get_precision()
 *                 if _prec is None or leaf_prec < _prec:
 *                     _prec = leaf_prec             # <<<<<<<<<<<<<<
 *         if _prec is not None:
 *             new_leaves = self.get_mutable_leaves()
 */
        __Pyx_INCREF(__pyx_v_leaf_prec);
        __Pyx_DECREF_SET(__pyx_v__prec, __pyx_v_leaf_prec);

        /* "mathics/core/expression.py":1862
 *             if leaf.is_inexact():
 *                 leaf_prec = leaf.get_precision()
 *                 if _prec is None or leaf_prec < _prec:             # <<<<<<<<<<<<<<
 *                     _prec = leaf_prec
 *         if _prec is not None:
 */
      }

      /* "mathics/core/expression.py":1860
 *         _prec = None
 *         for leaf in self._leaves:
 *             if leaf.is_inexact():             # <<<<<<<<<<<<<<
 *                 leaf_prec = leaf.get_precision()
 *                 if _prec is None or leaf_prec < _prec:
 */
    }

    /* "mathics/core/expression.py":1859
 *     def numerify(self, evaluation) -> "Expression":
 *         _prec = None
 *         for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *             if leaf.is_inexact():
 *                 leaf_prec = leaf.get_precision()
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1864
 *                 if _prec is None or leaf_prec < _prec:
 *                     _prec = leaf_prec
 *         if _prec is not None:             # <<<<<<<<<<<<<<
 *             new_leaves = self.get_mutable_leaves()
 *             for index in range(len(new_leaves)):
 */
  __pyx_t_7 = (__pyx_v__prec != Py_None);
  __pyx_t_9 = (__pyx_t_7 != 0);
  if (__pyx_t_9) {

    /* "mathics/core/expression.py":1865
 *                     _prec = leaf_prec
 *         if _prec is not None:
 *             new_leaves = self.get_mutable_leaves()             # <<<<<<<<<<<<<<
 *             for index in range(len(new_leaves)):
 *                 leaf = new_leaves[index]
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_mutable_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1865, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1865, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_new_leaves = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1866
 *         if _prec is not None:
 *             new_leaves = self.get_mutable_leaves()
 *             for index in range(len(new_leaves)):             # <<<<<<<<<<<<<<
 *                 leaf = new_leaves[index]
 *                 # Don't "numerify" numbers: they should be numerified
 */
    __pyx_t_3 = PyObject_Length(__pyx_v_new_leaves); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1866, __pyx_L1_error)
    __pyx_t_10 = __pyx_t_3;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_index = __pyx_t_11;

      /* "mathics/core/expression.py":1867
 *             new_leaves = self.get_mutable_leaves()
 *             for index in range(len(new_leaves)):
 *                 leaf = new_leaves[index]             # <<<<<<<<<<<<<<
 *                 # Don't "numerify" numbers: they should be numerified
 *                 # automatically by the processing function,
 */
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_new_leaves, __pyx_v_index, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1867, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":1871
 *                 # automatically by the processing function,
 *                 # and we don't want to lose exactness in e.g. 1.0+I.
 *                 if not isinstance(leaf, Number):             # <<<<<<<<<<<<<<
 *                     n_expr = Expression(SymbolN, leaf, Integer(dps(_prec)))
 *                     n_result = n_expr.evaluate(evaluation)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Number); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1871, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = PyObject_IsInstance(__pyx_v_leaf, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1871, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = ((!(__pyx_t_9 != 0)) != 0);
      if (__pyx_t_7) {

        /* "mathics/core/expression.py":1872
 *                 # and we don't want to lose exactness in e.g. 1.0+I.
 *                 if not isinstance(leaf, Number):
 *                     n_expr = Expression(SymbolN, leaf, Integer(dps(_prec)))             # <<<<<<<<<<<<<<
 *                     n_result = n_expr.evaluate(evaluation)
 *                     if isinstance(n_result, Number):
 */
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1872, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1872, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_Integer); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1872, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_dps); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1872, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_15 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        __pyx_t_13 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_v__prec) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v__prec);
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1872, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
          }
        }
        __pyx_t_6 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_13);
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1872, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = NULL;
        __pyx_t_16 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_16 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_t_5, __pyx_v_leaf, __pyx_t_6};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 3+__pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1872, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_t_5, __pyx_v_leaf, __pyx_t_6};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 3+__pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1872, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_13 = PyTuple_New(3+__pyx_t_16); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1872, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (__pyx_t_12) {
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_16, __pyx_t_5);
          __Pyx_INCREF(__pyx_v_leaf);
          __Pyx_GIVEREF(__pyx_v_leaf);
          PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_16, __pyx_v_leaf);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_16, __pyx_t_6);
          __pyx_t_5 = 0;
          __pyx_t_6 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1872, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF_SET(__pyx_v_n_expr, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1873
 *                 if not isinstance(leaf, Number):
 *                     n_expr = Expression(SymbolN, leaf, Integer(dps(_prec)))
 *                     n_result = n_expr.evaluate(evaluation)             # <<<<<<<<<<<<<<
 *                     if isinstance(n_result, Number):
 *                         new_leaves[index] = n_result
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_n_expr, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1873, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_13 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_2 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_13, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_evaluation);
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1873, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF_SET(__pyx_v_n_result, __pyx_t_2);
        __pyx_t_2 = 0;

        /* "mathics/core/expression.py":1874
 *                     n_expr = Expression(SymbolN, leaf, Integer(dps(_prec)))
 *                     n_result = n_expr.evaluate(evaluation)
 *                     if isinstance(n_result, Number):             # <<<<<<<<<<<<<<
 *                         new_leaves[index] = n_result
 *             return Expression(self._head, *new_leaves)
 */
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Number); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1874, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = PyObject_IsInstance(__pyx_v_n_result, __pyx_t_2); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1874, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_9 = (__pyx_t_7 != 0);
        if (__pyx_t_9) {

          /* "mathics/core/expression.py":1875
 *                     n_result = n_expr.evaluate(evaluation)
 *                     if isinstance(n_result, Number):
 *                         new_leaves[index] = n_result             # <<<<<<<<<<<<<<
 *             return Expression(self._head, *new_leaves)
 *         else:
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_new_leaves, __pyx_v_index, __pyx_v_n_result, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) __PYX_ERR(0, 1875, __pyx_L1_error)

          /* "mathics/core/expression.py":1874
 *                     n_expr = Expression(SymbolN, leaf, Integer(dps(_prec)))
 *                     n_result = n_expr.evaluate(evaluation)
 *                     if isinstance(n_result, Number):             # <<<<<<<<<<<<<<
 *                         new_leaves[index] = n_result
 *             return Expression(self._head, *new_leaves)
 */
        }

        /* "mathics/core/expression.py":1871
 *                 # automatically by the processing function,
 *                 # and we don't want to lose exactness in e.g. 1.0+I.
 *                 if not isinstance(leaf, Number):             # <<<<<<<<<<<<<<
 *                     n_expr = Expression(SymbolN, leaf, Integer(dps(_prec)))
 *                     n_result = n_expr.evaluate(evaluation)
 */
      }
    }

    /* "mathics/core/expression.py":1876
 *                     if isinstance(n_result, Number):
 *                         new_leaves[index] = n_result
 *             return Expression(self._head, *new_leaves)             # <<<<<<<<<<<<<<
 *         else:
 *             return self
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_new_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyNumber_Add(__pyx_t_13, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1864
 *                 if _prec is None or leaf_prec < _prec:
 *                     _prec = leaf_prec
 *         if _prec is not None:             # <<<<<<<<<<<<<<
 *             new_leaves = self.get_mutable_leaves()
 *             for index in range(len(new_leaves)):
 */
  }

  /* "mathics/core/expression.py":1878
 *             return Expression(self._head, *new_leaves)
 *         else:
 *             return self             # <<<<<<<<<<<<<<
 * 
 *     def get_atoms(self, include_heads=True):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":1857
 *         # attribute
 * 
 *     def numerify(self, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         _prec = None
 *         for leaf in self._leaves:
 */

  /* 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_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("mathics.core.expression.Expression.numerify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__prec);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_v_leaf_prec);
  __Pyx_XDECREF(__pyx_v_new_leaves);
  __Pyx_XDECREF(__pyx_v_n_expr);
  __Pyx_XDECREF(__pyx_v_n_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1880
 *             return self
 * 
 *     def get_atoms(self, include_heads=True):             # <<<<<<<<<<<<<<
 *         if include_heads:
 *             atoms = self._head.get_atoms()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_111get_atoms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_111get_atoms = {"get_atoms", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_111get_atoms, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_111get_atoms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_include_heads = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_atoms (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_include_heads,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_include_heads);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_atoms") < 0)) __PYX_ERR(0, 1880, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_include_heads = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_atoms", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1880, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_atoms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_110get_atoms(__pyx_self, __pyx_v_self, __pyx_v_include_heads);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_110get_atoms(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_include_heads) {
  PyObject *__pyx_v_atoms = NULL;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  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("get_atoms", 0);

  /* "mathics/core/expression.py":1881
 * 
 *     def get_atoms(self, include_heads=True):
 *         if include_heads:             # <<<<<<<<<<<<<<
 *             atoms = self._head.get_atoms()
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_include_heads); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1881, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":1882
 *     def get_atoms(self, include_heads=True):
 *         if include_heads:
 *             atoms = self._head.get_atoms()             # <<<<<<<<<<<<<<
 *         else:
 *             atoms = []
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1882, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_atoms); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1882, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1882, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_atoms = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1881
 * 
 *     def get_atoms(self, include_heads=True):
 *         if include_heads:             # <<<<<<<<<<<<<<
 *             atoms = self._head.get_atoms()
 *         else:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":1884
 *             atoms = self._head.get_atoms()
 *         else:
 *             atoms = []             # <<<<<<<<<<<<<<
 *         for leaf in self._leaves:
 *             atoms.extend(leaf.get_atoms())
 */
  /*else*/ {
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_atoms = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":1885
 *         else:
 *             atoms = []
 *         for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *             atoms.extend(leaf.get_atoms())
 *         return atoms
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1885, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1885, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1885, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1885, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1885, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1885, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1885, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":1886
 *             atoms = []
 *         for leaf in self._leaves:
 *             atoms.extend(leaf.get_atoms())             # <<<<<<<<<<<<<<
 *         return atoms
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_atoms, __pyx_n_s_extend); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_get_atoms); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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_7 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_2 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1886, __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;

    /* "mathics/core/expression.py":1885
 *         else:
 *             atoms = []
 *         for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *             atoms.extend(leaf.get_atoms())
 *         return atoms
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1887
 *         for leaf in self._leaves:
 *             atoms.extend(leaf.get_atoms())
 *         return atoms             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_atoms);
  __pyx_r = __pyx_v_atoms;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1880
 *             return self
 * 
 *     def get_atoms(self, include_heads=True):             # <<<<<<<<<<<<<<
 *         if include_heads:
 *             atoms = self._head.get_atoms()
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.core.expression.Expression.get_atoms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_atoms);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1889
 *         return atoms
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Expression", self._head) + tuple(self._leaves))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_113__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_113__hash__ = {"__hash__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_113__hash__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_113__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_112__hash__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":1890
 * 
 *     def __hash__(self):
 *         return hash(("Expression", self._head) + tuple(self._leaves))             # <<<<<<<<<<<<<<
 * 
 *     def user_hash(self, update):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_Expression);
  __Pyx_GIVEREF(__pyx_n_u_Expression);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_Expression);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = PyObject_Hash(__pyx_t_1); if (unlikely(__pyx_t_4 == ((Py_hash_t)-1))) __PYX_ERR(0, 1890, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_FromHash_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1889
 *         return atoms
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Expression", self._head) + tuple(self._leaves))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Expression.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1892
 *         return hash(("Expression", self._head) + tuple(self._leaves))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         update(("%s>%d>" % (self.get_head_name(), len(self._leaves))).encode("utf8"))
 *         for leaf in self._leaves:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_115user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_115user_hash = {"user_hash", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_10Expression_115user_hash, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_115user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_update = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("user_hash (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_update,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_update)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, 1); __PYX_ERR(0, 1892, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "user_hash") < 0)) __PYX_ERR(0, 1892, __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_update = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1892, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Expression.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_114user_hash(__pyx_self, __pyx_v_self, __pyx_v_update);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10Expression_114user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update) {
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_UCS4 __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("user_hash", 0);

  /* "mathics/core/expression.py":1893
 * 
 *     def user_hash(self, update):
 *         update(("%s>%d>" % (self.get_head_name(), len(self._leaves))).encode("utf8"))             # <<<<<<<<<<<<<<
 *         for leaf in self._leaves:
 *             leaf.user_hash(update)
 */
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_4 = 127;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_5), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_4;
  __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_kp_u__69);
  __pyx_t_3 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__69);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u__69);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyObject_Length(__pyx_t_6); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_t_8, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_6);
  __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_kp_u__69);
  __pyx_t_3 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__69);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_kp_u__69);
  __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_2, 4, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_6)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_INCREF(__pyx_v_update);
  __pyx_t_6 = __pyx_v_update; __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1894
 *     def user_hash(self, update):
 *         update(("%s>%d>" % (self.get_head_name(), len(self._leaves))).encode("utf8"))
 *         for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *             leaf.user_hash(update)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_3 = 0;
    __pyx_t_9 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1894, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_9)) {
      if (likely(PyList_CheckExact(__pyx_t_6))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1894, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1894, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_9(__pyx_t_6);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1894, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1895
 *         update(("%s>%d>" % (self.get_head_name(), len(self._leaves))).encode("utf8"))
 *         for leaf in self._leaves:
 *             leaf.user_hash(update)             # <<<<<<<<<<<<<<
 * 
 *     def __getnewargs__(self):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_leaf, __pyx_n_s_user_hash); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1895, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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_v_update) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_update);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1895, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1894
 *     def user_hash(self, update):
 *         update(("%s>%d>" % (self.get_head_name(), len(self._leaves))).encode("utf8"))
 *         for leaf in self._leaves:             # <<<<<<<<<<<<<<
 *             leaf.user_hash(update)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":1892
 *         return hash(("Expression", self._head) + tuple(self._leaves))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         update(("%s>%d>" % (self.get_head_name(), len(self._leaves))).encode("utf8"))
 *         for leaf in self._leaves:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.Expression.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1897
 *             leaf.user_hash(update)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self._head, self._leaves)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_117__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10Expression_117__getnewargs__ = {"__getnewargs__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10Expression_117__getnewargs__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10Expression_117__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getnewargs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10Expression_116__getnewargs__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":1898
 * 
 *     def __getnewargs__(self):
 *         return (self._head, self._leaves)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1898, __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;

  /* "mathics/core/expression.py":1897
 *             leaf.user_hash(update)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self._head, self._leaves)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Expression.__getnewargs__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1902
 * 
 * class Atom(BaseExpression):
 *     def is_atom(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_1is_atom(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_1is_atom = {"is_atom", (PyCFunction)__pyx_pw_7mathics_4core_10expression_4Atom_1is_atom, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_1is_atom(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_atom (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_is_atom(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_is_atom(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_atom", 0);

  /* "mathics/core/expression.py":1903
 * class Atom(BaseExpression):
 *     def is_atom(self) -> bool:
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1902
 * 
 * class Atom(BaseExpression):
 *     def is_atom(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */

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

/* "mathics/core/expression.py":1905
 *         return True
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_3equal2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_4Atom_2equal2[] = "Mathics two-argument Equal (==)\n        returns True if self and rhs are identical.\n        ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_3equal2 = {"equal2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_3equal2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_4Atom_2equal2};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_3equal2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_rhs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("equal2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rhs,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_rhs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("equal2", 1, 2, 2, 1); __PYX_ERR(0, 1905, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "equal2") < 0)) __PYX_ERR(0, 1905, __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_rhs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("equal2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1905, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.equal2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_2equal2(__pyx_self, __pyx_v_self, __pyx_v_rhs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_2equal2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) {
  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("equal2", 0);

  /* "mathics/core/expression.py":1909
 *         returns True if self and rhs are identical.
 *         """
 *         if self.sameQ(rhs):             # <<<<<<<<<<<<<<
 *             return True
 *         if isinstance(rhs, Symbol) or not isinstance(rhs, Atom):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1909, __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_rhs) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_rhs);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1909, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1910
 *         """
 *         if self.sameQ(rhs):
 *             return True             # <<<<<<<<<<<<<<
 *         if isinstance(rhs, Symbol) or not isinstance(rhs, Atom):
 *             return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1909
 *         returns True if self and rhs are identical.
 *         """
 *         if self.sameQ(rhs):             # <<<<<<<<<<<<<<
 *             return True
 *         if isinstance(rhs, Symbol) or not isinstance(rhs, Atom):
 */
  }

  /* "mathics/core/expression.py":1911
 *         if self.sameQ(rhs):
 *             return True
 *         if isinstance(rhs, Symbol) or not isinstance(rhs, Atom):             # <<<<<<<<<<<<<<
 *             return None
 *         return self == rhs
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_rhs, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1911, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Atom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyObject_IsInstance(__pyx_v_rhs, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1911, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1912
 *             return True
 *         if isinstance(rhs, Symbol) or not isinstance(rhs, Atom):
 *             return None             # <<<<<<<<<<<<<<
 *         return self == rhs
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/core/expression.py":1911
 *         if self.sameQ(rhs):
 *             return True
 *         if isinstance(rhs, Symbol) or not isinstance(rhs, Atom):             # <<<<<<<<<<<<<<
 *             return None
 *         return self == rhs
 */
  }

  /* "mathics/core/expression.py":1913
 *         if isinstance(rhs, Symbol) or not isinstance(rhs, Atom):
 *             return None
 *         return self == rhs             # <<<<<<<<<<<<<<
 * 
 *     def has_form(self, heads, *leaf_counts) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_self, __pyx_v_rhs, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1913, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1905
 *         return True
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Atom.equal2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1915
 *         return self == rhs
 * 
 *     def has_form(self, heads, *leaf_counts) -> bool:             # <<<<<<<<<<<<<<
 *         if leaf_counts:
 *             return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_5has_form(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_5has_form = {"has_form", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_5has_form, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_5has_form(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_heads = 0;
  PyObject *__pyx_v_leaf_counts = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_form (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_leaf_counts = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_leaf_counts)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_leaf_counts);
  } else {
    __pyx_v_leaf_counts = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_heads,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_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_heads)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("has_form", 0, 2, 2, 1); __PYX_ERR(0, 1915, __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, 0, values, used_pos_args, "has_form") < 0)) __PYX_ERR(0, 1915, __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_heads = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_form", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1915, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_leaf_counts); __pyx_v_leaf_counts = 0;
  __Pyx_AddTraceback("mathics.core.expression.Atom.has_form", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_4has_form(__pyx_self, __pyx_v_self, __pyx_v_heads, __pyx_v_leaf_counts);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_4has_form(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_heads, PyObject *__pyx_v_leaf_counts) {
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("has_form", 0);

  /* "mathics/core/expression.py":1916
 * 
 *     def has_form(self, heads, *leaf_counts) -> bool:
 *         if leaf_counts:             # <<<<<<<<<<<<<<
 *             return False
 *         name = self.get_atom_name()
 */
  __pyx_t_1 = (PyTuple_GET_SIZE(__pyx_v_leaf_counts) != 0);
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":1917
 *     def has_form(self, heads, *leaf_counts) -> bool:
 *         if leaf_counts:
 *             return False             # <<<<<<<<<<<<<<
 *         name = self.get_atom_name()
 *         if isinstance(heads, tuple):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1916
 * 
 *     def has_form(self, heads, *leaf_counts) -> bool:
 *         if leaf_counts:             # <<<<<<<<<<<<<<
 *             return False
 *         name = self.get_atom_name()
 */
  }

  /* "mathics/core/expression.py":1918
 *         if leaf_counts:
 *             return False
 *         name = self.get_atom_name()             # <<<<<<<<<<<<<<
 *         if isinstance(heads, tuple):
 *             return name in heads
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_atom_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 1918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_name = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1919
 *             return False
 *         name = self.get_atom_name()
 *         if isinstance(heads, tuple):             # <<<<<<<<<<<<<<
 *             return name in heads
 *         else:
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_heads); 
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":1920
 *         name = self.get_atom_name()
 *         if isinstance(heads, tuple):
 *             return name in heads             # <<<<<<<<<<<<<<
 *         else:
 *             return heads == name
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_name, __pyx_v_heads, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1920, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1919
 *             return False
 *         name = self.get_atom_name()
 *         if isinstance(heads, tuple):             # <<<<<<<<<<<<<<
 *             return name in heads
 *         else:
 */
  }

  /* "mathics/core/expression.py":1922
 *             return name in heads
 *         else:
 *             return heads == name             # <<<<<<<<<<<<<<
 * 
 *     def has_symbol(self, symbol_name) -> bool:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_heads, __pyx_v_name, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1922, __pyx_L1_error)
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":1915
 *         return self == rhs
 * 
 *     def has_form(self, heads, *leaf_counts) -> bool:             # <<<<<<<<<<<<<<
 *         if leaf_counts:
 *             return False
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.Atom.has_form", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1924
 *             return heads == name
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_7has_symbol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_7has_symbol = {"has_symbol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_7has_symbol, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_7has_symbol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_symbol_name = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_symbol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_symbol_name,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_symbol_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("has_symbol", 1, 2, 2, 1); __PYX_ERR(0, 1924, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "has_symbol") < 0)) __PYX_ERR(0, 1924, __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_symbol_name = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_symbol", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1924, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.has_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_6has_symbol(__pyx_self, __pyx_v_self, __pyx_v_symbol_name);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_6has_symbol(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_symbol_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_symbol", 0);

  /* "mathics/core/expression.py":1925
 * 
 *     def has_symbol(self, symbol_name) -> bool:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def get_head(self) -> "Symbol":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1924
 *             return heads == name
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */

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

/* "mathics/core/expression.py":1927
 *         return False
 * 
 *     def get_head(self) -> "Symbol":             # <<<<<<<<<<<<<<
 *         return Symbol(self.get_atom_name())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_9get_head(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_9get_head = {"get_head", (PyCFunction)__pyx_pw_7mathics_4core_10expression_4Atom_9get_head, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_9get_head(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_head (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_8get_head(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_8get_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  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_head", 0);

  /* "mathics/core/expression.py":1928
 * 
 *     def get_head(self) -> "Symbol":
 *         return Symbol(self.get_atom_name())             # <<<<<<<<<<<<<<
 * 
 *     def get_atom_name(self) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_atom_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1928, __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, 1928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1928, __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;

  /* "mathics/core/expression.py":1927
 *         return False
 * 
 *     def get_head(self) -> "Symbol":             # <<<<<<<<<<<<<<
 *         return Symbol(self.get_atom_name())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Atom.get_head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1930
 *         return Symbol(self.get_atom_name())
 * 
 *     def get_atom_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.__class__.__name__
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_11get_atom_name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_11get_atom_name = {"get_atom_name", (PyCFunction)__pyx_pw_7mathics_4core_10expression_4Atom_11get_atom_name, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_11get_atom_name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_atom_name (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_10get_atom_name(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":1931
 * 
 *     def get_atom_name(self) -> str:
 *         return self.__class__.__name__             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1931, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1930
 *         return Symbol(self.get_atom_name())
 * 
 *     def get_atom_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.__class__.__name__
 * 
 */

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

/* "mathics/core/expression.py":1933
 *         return self.__class__.__name__
 * 
 *     def __repr__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "<%s: %s>" % (self.get_atom_name(), self)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_13__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_13__repr__ = {"__repr__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_4Atom_13__repr__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_13__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_12__repr__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_12__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "mathics/core/expression.py":1934
 * 
 *     def __repr__(self) -> str:
 *         return "<%s: %s>" % (self.get_atom_name(), self)             # <<<<<<<<<<<<<<
 * 
 *     def replace_vars(self, vars, options=None, in_scoping=True) -> "Atom":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u__70);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__70);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u__70);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_atom_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1934, __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, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_kp_u__71);
  __pyx_t_2 += 2;
  __Pyx_GIVEREF(__pyx_kp_u__71);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__71);
  __pyx_t_5 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_self), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1934, __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__69);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__69);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__69);
  __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1933
 *         return self.__class__.__name__
 * 
 *     def __repr__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "<%s: %s>" % (self.get_atom_name(), self)
 * 
 */

  /* 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("mathics.core.expression.Atom.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1936
 *         return "<%s: %s>" % (self.get_atom_name(), self)
 * 
 *     def replace_vars(self, vars, options=None, in_scoping=True) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_15replace_vars(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_15replace_vars = {"replace_vars", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_15replace_vars, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_15replace_vars(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_vars = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  CYTHON_UNUSED PyObject *__pyx_v_in_scoping = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace_vars (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_vars,&__pyx_n_s_options,&__pyx_n_s_in_scoping,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_vars)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace_vars", 0, 2, 4, 1); __PYX_ERR(0, 1936, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          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_in_scoping);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace_vars") < 0)) __PYX_ERR(0, 1936, __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_self = values[0];
    __pyx_v_vars = values[1];
    __pyx_v_options = values[2];
    __pyx_v_in_scoping = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace_vars", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1936, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.replace_vars", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_14replace_vars(__pyx_self, __pyx_v_self, __pyx_v_vars, __pyx_v_options, __pyx_v_in_scoping);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_14replace_vars(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_vars, CYTHON_UNUSED PyObject *__pyx_v_options, CYTHON_UNUSED PyObject *__pyx_v_in_scoping) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace_vars", 0);

  /* "mathics/core/expression.py":1937
 * 
 *     def replace_vars(self, vars, options=None, in_scoping=True) -> "Atom":
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def replace_slots(self, slots, evaluation) -> "Atom":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1936
 *         return "<%s: %s>" % (self.get_atom_name(), self)
 * 
 *     def replace_vars(self, vars, options=None, in_scoping=True) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "mathics/core/expression.py":1939
 *         return self
 * 
 *     def replace_slots(self, slots, evaluation) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_17replace_slots(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_17replace_slots = {"replace_slots", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_17replace_slots, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_17replace_slots(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_slots = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace_slots (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_slots,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_slots)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace_slots", 1, 3, 3, 1); __PYX_ERR(0, 1939, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace_slots", 1, 3, 3, 2); __PYX_ERR(0, 1939, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace_slots") < 0)) __PYX_ERR(0, 1939, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_slots = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace_slots", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1939, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.replace_slots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_16replace_slots(__pyx_self, __pyx_v_self, __pyx_v_slots, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_16replace_slots(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_slots, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace_slots", 0);

  /* "mathics/core/expression.py":1940
 * 
 *     def replace_slots(self, slots, evaluation) -> "Atom":
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def numerify(self, evaluation) -> "Atom":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1939
 *         return self
 * 
 *     def replace_slots(self, slots, evaluation) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "mathics/core/expression.py":1942
 *         return self
 * 
 *     def numerify(self, evaluation) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_19numerify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_19numerify = {"numerify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_19numerify, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_19numerify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numerify (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("numerify", 1, 2, 2, 1); __PYX_ERR(0, 1942, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "numerify") < 0)) __PYX_ERR(0, 1942, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("numerify", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1942, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.numerify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_18numerify(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_18numerify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numerify", 0);

  /* "mathics/core/expression.py":1943
 * 
 *     def numerify(self, evaluation) -> "Atom":
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def copy(self, reevaluate=False) -> "Atom":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1942
 *         return self
 * 
 *     def numerify(self, evaluation) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "mathics/core/expression.py":1945
 *         return self
 * 
 *     def copy(self, reevaluate=False) -> "Atom":             # <<<<<<<<<<<<<<
 *         result = self.do_copy()
 *         result.original = self
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_21copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_21copy = {"copy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_21copy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_21copy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_reevaluate = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_reevaluate,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reevaluate);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy") < 0)) __PYX_ERR(0, 1945, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_reevaluate = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("copy", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1945, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_20copy(__pyx_self, __pyx_v_self, __pyx_v_reevaluate);

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

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

  /* "mathics/core/expression.py":1946
 * 
 *     def copy(self, reevaluate=False) -> "Atom":
 *         result = self.do_copy()             # <<<<<<<<<<<<<<
 *         result.original = self
 *         return result
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_do_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1946, __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, 1946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1947
 *     def copy(self, reevaluate=False) -> "Atom":
 *         result = self.do_copy()
 *         result.original = self             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_original, __pyx_v_self) < 0) __PYX_ERR(0, 1947, __pyx_L1_error)

  /* "mathics/core/expression.py":1948
 *         result = self.do_copy()
 *         result.original = self
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def set_positions(self, position=None) -> None:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1945
 *         return self
 * 
 *     def copy(self, reevaluate=False) -> "Atom":             # <<<<<<<<<<<<<<
 *         result = self.do_copy()
 *         result.original = self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Atom.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1950
 *         return result
 * 
 *     def set_positions(self, position=None) -> None:             # <<<<<<<<<<<<<<
 *         self.position = position
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_23set_positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_23set_positions = {"set_positions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_23set_positions, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_23set_positions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_position = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_positions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_position,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_position);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_positions") < 0)) __PYX_ERR(0, 1950, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_position = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_positions", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1950, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.set_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_22set_positions(__pyx_self, __pyx_v_self, __pyx_v_position);

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

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

  /* "mathics/core/expression.py":1951
 * 
 *     def set_positions(self, position=None) -> None:
 *         self.position = position             # <<<<<<<<<<<<<<
 * 
 *     def get_sort_key(self, pattern_sort=False):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_position, __pyx_v_position) < 0) __PYX_ERR(0, 1951, __pyx_L1_error)

  /* "mathics/core/expression.py":1950
 *         return result
 * 
 *     def set_positions(self, position=None) -> None:             # <<<<<<<<<<<<<<
 *         self.position = position
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.set_positions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1953
 *         self.position = position
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return [0, 0, 1, 1, 0, 0, 0, 1]
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_25get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_25get_sort_key = {"get_sort_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_25get_sort_key, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_25get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_pattern_sort = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sort_key (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_pattern_sort,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_sort);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_sort_key") < 0)) __PYX_ERR(0, 1953, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_pattern_sort = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_sort_key", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1953, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_24get_sort_key(__pyx_self, __pyx_v_self, __pyx_v_pattern_sort);

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

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

  /* "mathics/core/expression.py":1954
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return [0, 0, 1, 1, 0, 0, 0, 1]
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_sort); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1954, __pyx_L1_error)
  if (likely(__pyx_t_1)) {

    /* "mathics/core/expression.py":1955
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:
 *             return [0, 0, 1, 1, 0, 0, 0, 1]             # <<<<<<<<<<<<<<
 *         else:
 *             raise NotImplementedError
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1955, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_1);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_2, 3, __pyx_int_1);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_2, 4, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_2, 5, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_2, 6, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_2, 7, __pyx_int_1);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1954
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return [0, 0, 1, 1, 0, 0, 0, 1]
 *         else:
 */
  }

  /* "mathics/core/expression.py":1957
 *             return [0, 0, 1, 1, 0, 0, 0, 1]
 *         else:
 *             raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def get_atoms(self, include_heads=True) -> typing.List["Atom"]:
 */
  /*else*/ {
    __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
    __PYX_ERR(0, 1957, __pyx_L1_error)
  }

  /* "mathics/core/expression.py":1953
 *         self.position = position
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return [0, 0, 1, 1, 0, 0, 0, 1]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.core.expression.Atom.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1959
 *             raise NotImplementedError
 * 
 *     def get_atoms(self, include_heads=True) -> typing.List["Atom"]:             # <<<<<<<<<<<<<<
 *         return [self]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_27get_atoms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_27get_atoms = {"get_atoms", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_27get_atoms, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_27get_atoms(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_include_heads = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_atoms (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_include_heads,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_include_heads);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_atoms") < 0)) __PYX_ERR(0, 1959, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_include_heads = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_atoms", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1959, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.get_atoms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_26get_atoms(__pyx_self, __pyx_v_self, __pyx_v_include_heads);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Atom_26get_atoms(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_include_heads) {
  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_atoms", 0);

  /* "mathics/core/expression.py":1960
 * 
 *     def get_atoms(self, include_heads=True) -> typing.List["Atom"]:
 *         return [self]             # <<<<<<<<<<<<<<
 * 
 *     def atom_to_boxes(self, f, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1959
 *             raise NotImplementedError
 * 
 *     def get_atoms(self, include_heads=True) -> typing.List["Atom"]:             # <<<<<<<<<<<<<<
 *         return [self]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Atom.get_atoms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1962
 *         return [self]
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_29atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Atom_29atom_to_boxes = {"atom_to_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Atom_29atom_to_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Atom_29atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_f = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atom_to_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_f,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 1); __PYX_ERR(0, 1962, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 2); __PYX_ERR(0, 1962, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atom_to_boxes") < 0)) __PYX_ERR(0, 1962, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_f = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1962, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Atom_28atom_to_boxes(__pyx_self, __pyx_v_self, __pyx_v_f, __pyx_v_evaluation);

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

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

  /* "mathics/core/expression.py":1963
 * 
 *     def atom_to_boxes(self, f, evaluation):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 1963, __pyx_L1_error)

  /* "mathics/core/expression.py":1962
 *         return [self]
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Atom.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1971
 *     defined_symbols = {}
 * 
 *     def __new__(cls, name, sympy_dummy=None):             # <<<<<<<<<<<<<<
 *         name = ensure_context(name)
 *         self = cls.defined_symbols.get(name, None)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_sympy_dummy = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_name,&__pyx_n_s_sympy_dummy,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 3, 1); __PYX_ERR(0, 1971, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sympy_dummy);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 1971, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_cls = values[0];
    __pyx_v_name = values[1];
    __pyx_v_sympy_dummy = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1971, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol___new__(__pyx_self, __pyx_v_cls, __pyx_v_name, __pyx_v_sympy_dummy);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_name, PyObject *__pyx_v_sympy_dummy) {
  PyObject *__pyx_v_self = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "mathics/core/expression.py":1972
 * 
 *     def __new__(cls, name, sympy_dummy=None):
 *         name = ensure_context(name)             # <<<<<<<<<<<<<<
 *         self = cls.defined_symbols.get(name, None)
 *         if self is None:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ensure_context); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_name);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1973
 *     def __new__(cls, name, sympy_dummy=None):
 *         name = ensure_context(name)
 *         self = cls.defined_symbols.get(name, None)             # <<<<<<<<<<<<<<
 *         if self is None:
 *             self = super(Symbol, cls).__new__(cls)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_defined_symbols); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_name, Py_None};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_name, Py_None};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_name);
    __Pyx_GIVEREF(__pyx_v_name);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_name);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, Py_None);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1974
 *         name = ensure_context(name)
 *         self = cls.defined_symbols.get(name, None)
 *         if self is None:             # <<<<<<<<<<<<<<
 *             self = super(Symbol, cls).__new__(cls)
 *             self.name = name
 */
  __pyx_t_6 = (__pyx_v_self == Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "mathics/core/expression.py":1975
 *         self = cls.defined_symbols.get(name, None)
 *         if self is None:
 *             self = super(Symbol, cls).__new__(cls)             # <<<<<<<<<<<<<<
 *             self.name = name
 *             self.sympy_dummy = sympy_dummy
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_cls);
    __Pyx_GIVEREF(__pyx_v_cls);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_cls);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_new_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_v_cls) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_cls);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1975, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_self, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":1976
 *         if self is None:
 *             self = super(Symbol, cls).__new__(cls)
 *             self.name = name             # <<<<<<<<<<<<<<
 *             self.sympy_dummy = sympy_dummy
 *             # cls.defined_symbols[name] = self
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 1976, __pyx_L1_error)

    /* "mathics/core/expression.py":1977
 *             self = super(Symbol, cls).__new__(cls)
 *             self.name = name
 *             self.sympy_dummy = sympy_dummy             # <<<<<<<<<<<<<<
 *             # cls.defined_symbols[name] = self
 *         return self
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sympy_dummy, __pyx_v_sympy_dummy) < 0) __PYX_ERR(0, 1977, __pyx_L1_error)

    /* "mathics/core/expression.py":1974
 *         name = ensure_context(name)
 *         self = cls.defined_symbols.get(name, None)
 *         if self is None:             # <<<<<<<<<<<<<<
 *             self = super(Symbol, cls).__new__(cls)
 *             self.name = name
 */
  }

  /* "mathics/core/expression.py":1979
 *             self.sympy_dummy = sympy_dummy
 *             # cls.defined_symbols[name] = self
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1971
 *     defined_symbols = {}
 * 
 *     def __new__(cls, name, sympy_dummy=None):             # <<<<<<<<<<<<<<
 *         name = ensure_context(name)
 *         self = cls.defined_symbols.get(name, 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_5);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1981
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_3__str__ = {"__str__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6Symbol_3__str__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":1982
 * 
 *     def __str__(self) -> str:
 *         return self.name             # <<<<<<<<<<<<<<
 * 
 *     def do_copy(self) -> "Symbol":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 1982, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1981
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1984
 *         return self.name
 * 
 *     def do_copy(self) -> "Symbol":             # <<<<<<<<<<<<<<
 *         return Symbol(self.name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_5do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_5do_copy = {"do_copy", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6Symbol_5do_copy, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_5do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_4do_copy(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":1985
 * 
 *     def do_copy(self) -> "Symbol":
 *         return Symbol(self.name)             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_text(self, **options) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1985, __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;

  /* "mathics/core/expression.py":1984
 *         return self.name
 * 
 *     def do_copy(self) -> "Symbol":             # <<<<<<<<<<<<<<
 *         return Symbol(self.name)
 * 
 */

  /* 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("mathics.core.expression.Symbol.do_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1987
 *         return Symbol(self.name)
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_7boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_7boxes_to_text = {"boxes_to_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_7boxes_to_text, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_7boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_text (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_text") < 0)) __PYX_ERR(0, 1987, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_text", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1987, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.boxes_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_6boxes_to_text(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_6boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options) {
  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("boxes_to_text", 0);

  /* "mathics/core/expression.py":1988
 * 
 *     def boxes_to_text(self, **options) -> str:
 *         return str(self.name)             # <<<<<<<<<<<<<<
 * 
 *     def atom_to_boxes(self, f, evaluation) -> "String":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1987
 *         return Symbol(self.name)
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.name)
 * 
 */

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

/* "mathics/core/expression.py":1990
 *         return str(self.name)
 * 
 *     def atom_to_boxes(self, f, evaluation) -> "String":             # <<<<<<<<<<<<<<
 *         return String(evaluation.definitions.shorten_name(self.name))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_9atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_9atom_to_boxes = {"atom_to_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_9atom_to_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_9atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atom_to_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_f,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 1); __PYX_ERR(0, 1990, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 2); __PYX_ERR(0, 1990, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atom_to_boxes") < 0)) __PYX_ERR(0, 1990, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_f = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1990, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_8atom_to_boxes(__pyx_self, __pyx_v_self, __pyx_v_f, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_8atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_f, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("atom_to_boxes", 0);

  /* "mathics/core/expression.py":1991
 * 
 *     def atom_to_boxes(self, f, evaluation) -> "String":
 *         return String(evaluation.definitions.shorten_name(self.name))             # <<<<<<<<<<<<<<
 * 
 *     def to_sympy(self, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_String); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_shorten_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1991, __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_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1991, __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;

  /* "mathics/core/expression.py":1990
 *         return str(self.name)
 * 
 *     def atom_to_boxes(self, f, evaluation) -> "String":             # <<<<<<<<<<<<<<
 *         return String(evaluation.definitions.shorten_name(self.name))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":1993
 *         return String(evaluation.definitions.shorten_name(self.name))
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         from mathics.builtin import mathics_to_sympy
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_11to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_11to_sympy = {"to_sympy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_11to_sympy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_11to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 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("to_sympy (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "to_sympy") < 0)) __PYX_ERR(0, 1993, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_sympy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1993, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_10to_sympy(__pyx_self, __pyx_v_self, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_10to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_mathics_to_sympy = NULL;
  PyObject *__pyx_v_builtin = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_sympy", 0);

  /* "mathics/core/expression.py":1994
 * 
 *     def to_sympy(self, **kwargs):
 *         from mathics.builtin import mathics_to_sympy             # <<<<<<<<<<<<<<
 * 
 *         if self.sympy_dummy is not None:
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_mathics_to_sympy);
  __Pyx_GIVEREF(__pyx_n_s_mathics_to_sympy);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_mathics_to_sympy);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_builtin, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1994, __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_mathics_to_sympy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_mathics_to_sympy = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1996
 *         from mathics.builtin import mathics_to_sympy
 * 
 *         if self.sympy_dummy is not None:             # <<<<<<<<<<<<<<
 *             return self.sympy_dummy
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sympy_dummy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = (__pyx_t_2 != Py_None);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":1997
 * 
 *         if self.sympy_dummy is not None:
 *             return self.sympy_dummy             # <<<<<<<<<<<<<<
 * 
 *         builtin = mathics_to_sympy.get(self.name)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sympy_dummy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":1996
 *         from mathics.builtin import mathics_to_sympy
 * 
 *         if self.sympy_dummy is not None:             # <<<<<<<<<<<<<<
 *             return self.sympy_dummy
 * 
 */
  }

  /* "mathics/core/expression.py":1999
 *             return self.sympy_dummy
 * 
 *         builtin = mathics_to_sympy.get(self.name)             # <<<<<<<<<<<<<<
 *         if (
 *             builtin is None
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_mathics_to_sympy, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __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_2)) __PYX_ERR(0, 1999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_builtin = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2001
 *         builtin = mathics_to_sympy.get(self.name)
 *         if (
 *             builtin is None             # <<<<<<<<<<<<<<
 *             or not builtin.sympy_name
 *             or not builtin.is_constant()  # nopep8
 */
  __pyx_t_3 = (__pyx_v_builtin == Py_None);
  __pyx_t_7 = (__pyx_t_3 != 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_4 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }

  /* "mathics/core/expression.py":2002
 *         if (
 *             builtin is None
 *             or not builtin.sympy_name             # <<<<<<<<<<<<<<
 *             or not builtin.is_constant()  # nopep8
 *         ):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_builtin, __pyx_n_s_sympy_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2002, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = ((!__pyx_t_7) != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_4 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }

  /* "mathics/core/expression.py":2003
 *             builtin is None
 *             or not builtin.sympy_name
 *             or not builtin.is_constant()  # nopep8             # <<<<<<<<<<<<<<
 *         ):
 *             return sympy.Symbol(sympy_symbol_prefix + self.name)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_builtin, __pyx_n_s_is_constant); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2003, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = ((!__pyx_t_3) != 0);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;

  /* "mathics/core/expression.py":2000
 * 
 *         builtin = mathics_to_sympy.get(self.name)
 *         if (             # <<<<<<<<<<<<<<
 *             builtin is None
 *             or not builtin.sympy_name
 */
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2005
 *             or not builtin.is_constant()  # nopep8
 *         ):
 *             return sympy.Symbol(sympy_symbol_prefix + self.name)             # <<<<<<<<<<<<<<
 *         return builtin.to_sympy(self, **kwargs)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sympy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sympy_symbol_prefix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2000
 * 
 *         builtin = mathics_to_sympy.get(self.name)
 *         if (             # <<<<<<<<<<<<<<
 *             builtin is None
 *             or not builtin.sympy_name
 */
  }

  /* "mathics/core/expression.py":2006
 *         ):
 *             return sympy.Symbol(sympy_symbol_prefix + self.name)
 *         return builtin.to_sympy(self, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def to_python(self, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_builtin, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self);
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_v_kwargs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":1993
 *         return String(evaluation.definitions.shorten_name(self.name))
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         from mathics.builtin import mathics_to_sympy
 * 
 */

  /* 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_8);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mathics_to_sympy);
  __Pyx_XDECREF(__pyx_v_builtin);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2008
 *         return builtin.to_sympy(self, **kwargs)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         if self == SymbolTrue:
 *             return True
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_13to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_13to_python = {"to_python", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_13to_python, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_13to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED 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("to_python (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_self,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_self)) != 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, "to_python") < 0)) __PYX_ERR(0, 2008, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_python", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2008, __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("mathics.core.expression.Symbol.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_12to_python(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_12to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_n_evaluation = NULL;
  PyObject *__pyx_v_value = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("to_python", 0);

  /* "mathics/core/expression.py":2009
 * 
 *     def to_python(self, *args, **kwargs):
 *         if self == SymbolTrue:             # <<<<<<<<<<<<<<
 *             return True
 *         if self == SymbolFalse:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SymbolTrue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_self, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2009, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2009, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":2010
 *     def to_python(self, *args, **kwargs):
 *         if self == SymbolTrue:
 *             return True             # <<<<<<<<<<<<<<
 *         if self == SymbolFalse:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2009
 * 
 *     def to_python(self, *args, **kwargs):
 *         if self == SymbolTrue:             # <<<<<<<<<<<<<<
 *             return True
 *         if self == SymbolFalse:
 */
  }

  /* "mathics/core/expression.py":2011
 *         if self == SymbolTrue:
 *             return True
 *         if self == SymbolFalse:             # <<<<<<<<<<<<<<
 *             return False
 *         if self == SymbolNull:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SymbolFalse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_self, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2011, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2011, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":2012
 *             return True
 *         if self == SymbolFalse:
 *             return False             # <<<<<<<<<<<<<<
 *         if self == SymbolNull:
 *             return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2011
 *         if self == SymbolTrue:
 *             return True
 *         if self == SymbolFalse:             # <<<<<<<<<<<<<<
 *             return False
 *         if self == SymbolNull:
 */
  }

  /* "mathics/core/expression.py":2013
 *         if self == SymbolFalse:
 *             return False
 *         if self == SymbolNull:             # <<<<<<<<<<<<<<
 *             return None
 *         n_evaluation = kwargs.get("n_evaluation")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SymbolNull); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_self, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2013, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2013, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":2014
 *             return False
 *         if self == SymbolNull:
 *             return None             # <<<<<<<<<<<<<<
 *         n_evaluation = kwargs.get("n_evaluation")
 *         if n_evaluation is not None:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/core/expression.py":2013
 *         if self == SymbolFalse:
 *             return False
 *         if self == SymbolNull:             # <<<<<<<<<<<<<<
 *             return None
 *         n_evaluation = kwargs.get("n_evaluation")
 */
  }

  /* "mathics/core/expression.py":2015
 *         if self == SymbolNull:
 *             return None
 *         n_evaluation = kwargs.get("n_evaluation")             # <<<<<<<<<<<<<<
 *         if n_evaluation is not None:
 *             value = Expression(SymbolN, self).evaluate(n_evaluation)
 */
  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_u_n_evaluation, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_n_evaluation = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2016
 *             return None
 *         n_evaluation = kwargs.get("n_evaluation")
 *         if n_evaluation is not None:             # <<<<<<<<<<<<<<
 *             value = Expression(SymbolN, self).evaluate(n_evaluation)
 *             return value.to_python()
 */
  __pyx_t_3 = (__pyx_v_n_evaluation != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2017
 *         n_evaluation = kwargs.get("n_evaluation")
 *         if n_evaluation is not None:
 *             value = Expression(SymbolN, self).evaluate(n_evaluation)             # <<<<<<<<<<<<<<
 *             return value.to_python()
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Expression); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2017, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2017, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_self};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2017, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_self};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2017, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2017, __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_6);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_self);
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2017, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2017, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_1, __pyx_v_n_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_n_evaluation);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2017, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_value = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":2018
 *         if n_evaluation is not None:
 *             value = Expression(SymbolN, self).evaluate(n_evaluation)
 *             return value.to_python()             # <<<<<<<<<<<<<<
 * 
 *         if kwargs.get("python_form", False):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_to_python); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2018, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2018, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2016
 *             return None
 *         n_evaluation = kwargs.get("n_evaluation")
 *         if n_evaluation is not None:             # <<<<<<<<<<<<<<
 *             value = Expression(SymbolN, self).evaluate(n_evaluation)
 *             return value.to_python()
 */
  }

  /* "mathics/core/expression.py":2020
 *             return value.to_python()
 * 
 *         if kwargs.get("python_form", False):             # <<<<<<<<<<<<<<
 *             return self.to_sympy(**kwargs)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_u_python_form, Py_False); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2020, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2021
 * 
 *         if kwargs.get("python_form", False):
 *             return self.to_sympy(**kwargs)             # <<<<<<<<<<<<<<
 *         else:
 *             return self.name
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2020
 *             return value.to_python()
 * 
 *         if kwargs.get("python_form", False):             # <<<<<<<<<<<<<<
 *             return self.to_sympy(**kwargs)
 *         else:
 */
  }

  /* "mathics/core/expression.py":2023
 *             return self.to_sympy(**kwargs)
 *         else:
 *             return self.name             # <<<<<<<<<<<<<<
 * 
 *     def default_format(self, evaluation, form) -> str:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2023, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2008
 *         return builtin.to_sympy(self, **kwargs)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         if self == SymbolTrue:
 *             return True
 */

  /* 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_9);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n_evaluation);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2025
 *             return self.name
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_15default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_15default_format = {"default_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_15default_format, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_15default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  CYTHON_UNUSED PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 1); __PYX_ERR(0, 2025, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 2); __PYX_ERR(0, 2025, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_format") < 0)) __PYX_ERR(0, 2025, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2025, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_14default_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_14default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation, CYTHON_UNUSED PyObject *__pyx_v_form) {
  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("default_format", 0);

  /* "mathics/core/expression.py":2026
 * 
 *     def default_format(self, evaluation, form) -> str:
 *         return self.name             # <<<<<<<<<<<<<<
 * 
 *     def get_attributes(self, definitions):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2026, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2025
 *             return self.name
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2028
 *         return self.name
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         return definitions.get_attributes(self.name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_17get_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_17get_attributes = {"get_attributes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_17get_attributes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_17get_attributes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_definitions = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_attributes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_definitions,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_definitions)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_attributes", 1, 2, 2, 1); __PYX_ERR(0, 2028, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_attributes") < 0)) __PYX_ERR(0, 2028, __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_definitions = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_attributes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2028, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.get_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_16get_attributes(__pyx_self, __pyx_v_self, __pyx_v_definitions);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_16get_attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_definitions) {
  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("get_attributes", 0);

  /* "mathics/core/expression.py":2029
 * 
 *     def get_attributes(self, definitions):
 *         return definitions.get_attributes(self.name)             # <<<<<<<<<<<<<<
 * 
 *     def get_name(self) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_definitions, __pyx_n_s_get_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2029, __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, 2029, __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;

  /* "mathics/core/expression.py":2028
 *         return self.name
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         return definitions.get_attributes(self.name)
 * 
 */

  /* 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("mathics.core.expression.Symbol.get_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2031
 *         return definitions.get_attributes(self.name)
 * 
 *     def get_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_19get_name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_19get_name = {"get_name", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6Symbol_19get_name, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_19get_name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_name (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_18get_name(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2032
 * 
 *     def get_name(self) -> str:
 *         return self.name             # <<<<<<<<<<<<<<
 * 
 *     def is_symbol(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2032, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2031
 *         return definitions.get_attributes(self.name)
 * 
 *     def get_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.get_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2034
 *         return self.name
 * 
 *     def is_symbol(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_21is_symbol(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_21is_symbol = {"is_symbol", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6Symbol_21is_symbol, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_21is_symbol(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_symbol (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_20is_symbol(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_20is_symbol(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_symbol", 0);

  /* "mathics/core/expression.py":2035
 * 
 *     def is_symbol(self) -> bool:
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def get_sort_key(self, pattern_sort=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2034
 *         return self.name
 * 
 *     def is_symbol(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */

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

/* "mathics/core/expression.py":2037
 *         return True
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super(Symbol, self).get_sort_key(True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_23get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_23get_sort_key = {"get_sort_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_23get_sort_key, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_23get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_pattern_sort = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sort_key (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_pattern_sort,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_sort);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_sort_key") < 0)) __PYX_ERR(0, 2037, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_pattern_sort = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_sort_key", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2037, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_22get_sort_key(__pyx_self, __pyx_v_self, __pyx_v_pattern_sort);

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

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

  /* "mathics/core/expression.py":2038
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super(Symbol, self).get_sort_key(True)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_sort); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2038, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2039
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:
 *             return super(Symbol, self).get_sort_key(True)             # <<<<<<<<<<<<<<
 *         else:
 *             return [
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); 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_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2038
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super(Symbol, self).get_sort_key(True)
 *         else:
 */
  }

  /* "mathics/core/expression.py":2041
 *             return super(Symbol, self).get_sort_key(True)
 *         else:
 *             return [             # <<<<<<<<<<<<<<
 *                 1 if self.is_numeric() else 2,
 *                 2,
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);

    /* "mathics/core/expression.py":2042
 *         else:
 *             return [
 *                 1 if self.is_numeric() else 2,             # <<<<<<<<<<<<<<
 *                 2,
 *                 Monomial({self.name: 1}),
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2042, __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, 2042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2042, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_int_1);
      __pyx_t_2 = __pyx_int_1;
    } else {
      __Pyx_INCREF(__pyx_int_2);
      __pyx_t_2 = __pyx_int_2;
    }

    /* "mathics/core/expression.py":2044
 *                 1 if self.is_numeric() else 2,
 *                 2,
 *                 Monomial({self.name: 1}),             # <<<<<<<<<<<<<<
 *                 0,
 *                 self.name,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Monomial); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_5, __pyx_t_6, __pyx_int_1) < 0) __PYX_ERR(0, 2044, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __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_4)) __PYX_ERR(0, 2044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/core/expression.py":2046
 *                 Monomial({self.name: 1}),
 *                 0,
 *                 self.name,             # <<<<<<<<<<<<<<
 *                 1,
 *             ]
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "mathics/core/expression.py":2041
 *             return super(Symbol, self).get_sort_key(True)
 *         else:
 *             return [             # <<<<<<<<<<<<<<
 *                 1 if self.is_numeric() else 2,
 *                 2,
 */
    __pyx_t_5 = PyList_New(6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyList_SET_ITEM(__pyx_t_5, 1, __pyx_int_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_5, 3, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_5, 4, __pyx_t_3);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_5, 5, __pyx_int_1);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2037
 *         return True
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super(Symbol, self).get_sort_key(True)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2050
 *             ]
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)"""
 *         if self.sameQ(rhs):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_25equal2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_6Symbol_24equal2[] = "Mathics two-argument Equal (==)";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_25equal2 = {"equal2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_25equal2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_6Symbol_24equal2};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_25equal2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_rhs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("equal2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rhs,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_rhs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("equal2", 1, 2, 2, 1); __PYX_ERR(0, 2050, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "equal2") < 0)) __PYX_ERR(0, 2050, __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_rhs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("equal2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2050, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.equal2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_24equal2(__pyx_self, __pyx_v_self, __pyx_v_rhs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_24equal2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rhs) {
  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("equal2", 0);

  /* "mathics/core/expression.py":2052
 *     def equal2(self, rhs: Any) -> Optional[bool]:
 *         """Mathics two-argument Equal (==)"""
 *         if self.sameQ(rhs):             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2052, __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_rhs) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_rhs);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2052, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2053
 *         """Mathics two-argument Equal (==)"""
 *         if self.sameQ(rhs):
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         # Booleans are treated like constants, but all other symbols
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2052
 *     def equal2(self, rhs: Any) -> Optional[bool]:
 *         """Mathics two-argument Equal (==)"""
 *         if self.sameQ(rhs):             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  }

  /* "mathics/core/expression.py":2059
 *         # define equal2 in that, but for just this doesn't
 *         # seem to be worth it. If other things come up, this may change.
 *         if self in (SymbolTrue, SymbolFalse) and rhs in (SymbolTrue, SymbolFalse):             # <<<<<<<<<<<<<<
 *             return self == rhs
 *         return None
 */
  __Pyx_INCREF(__pyx_v_self);
  __pyx_t_1 = __pyx_v_self;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SymbolTrue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L7_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SymbolFalse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_t_6;
  __pyx_L7_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_v_rhs);
  __pyx_t_1 = __pyx_v_rhs;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SymbolTrue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_5) {
  } else {
    __pyx_t_6 = __pyx_t_5;
    goto __pyx_L9_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SymbolFalse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2059, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __pyx_t_5;
  __pyx_L9_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (__pyx_t_6 != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2060
 *         # seem to be worth it. If other things come up, this may change.
 *         if self in (SymbolTrue, SymbolFalse) and rhs in (SymbolTrue, SymbolFalse):
 *             return self == rhs             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_self, __pyx_v_rhs, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2060, __pyx_L1_error)
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2059
 *         # define equal2 in that, but for just this doesn't
 *         # seem to be worth it. If other things come up, this may change.
 *         if self in (SymbolTrue, SymbolFalse) and rhs in (SymbolTrue, SymbolFalse):             # <<<<<<<<<<<<<<
 *             return self == rhs
 *         return None
 */
  }

  /* "mathics/core/expression.py":2061
 *         if self in (SymbolTrue, SymbolFalse) and rhs in (SymbolTrue, SymbolFalse):
 *             return self == rhs
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def sameQ(self, rhs: Any) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":2050
 *             ]
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)"""
 *         if self.sameQ(rhs):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.equal2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2063
 *         return None
 * 
 *     def sameQ(self, rhs: Any) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_27sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_6Symbol_26sameQ[] = "Mathics SameQ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_27sameQ = {"sameQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_27sameQ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_6Symbol_26sameQ};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_27sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_rhs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sameQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rhs,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_rhs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, 1); __PYX_ERR(0, 2063, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sameQ") < 0)) __PYX_ERR(0, 2063, __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_rhs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2063, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_26sameQ(__pyx_self, __pyx_v_self, __pyx_v_rhs);

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

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

  /* "mathics/core/expression.py":2065
 *     def sameQ(self, rhs: Any) -> bool:
 *         """Mathics SameQ"""
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name             # <<<<<<<<<<<<<<
 * 
 *     def replace_vars(self, vars, options={}, in_scoping=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_rhs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2065, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2065, __pyx_L1_error)
  if (!__pyx_t_5) {
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_rhs, __pyx_t_4); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 2065, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_5) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_rhs, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2065, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2063
 *         return None
 * 
 *     def sameQ(self, rhs: Any) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name
 */

  /* 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("mathics.core.expression.Symbol.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2067
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name
 * 
 *     def replace_vars(self, vars, options={}, in_scoping=True):             # <<<<<<<<<<<<<<
 *         assert all(fully_qualified_symbol_name(v) for v in vars)
 *         var = vars.get(self.name, None)
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_38__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_options);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_options);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_options);
  __Pyx_INCREF(((PyObject *)Py_True));
  __Pyx_GIVEREF(((PyObject *)Py_True));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_True));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_29replace_vars(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_29replace_vars = {"replace_vars", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_29replace_vars, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_29replace_vars(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_vars = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  CYTHON_UNUSED PyObject *__pyx_v_in_scoping = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace_vars (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_vars,&__pyx_n_s_options,&__pyx_n_s_in_scoping,0};
    PyObject* values[4] = {0,0,0,0};
    __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
    values[2] = __pyx_dynamic_args->__pyx_arg_options;
    values[3] = ((PyObject *)((PyObject *)Py_True));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_vars)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("replace_vars", 0, 2, 4, 1); __PYX_ERR(0, 2067, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options);
          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_in_scoping);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "replace_vars") < 0)) __PYX_ERR(0, 2067, __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_self = values[0];
    __pyx_v_vars = values[1];
    __pyx_v_options = values[2];
    __pyx_v_in_scoping = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("replace_vars", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2067, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.replace_vars", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_28replace_vars(__pyx_self, __pyx_v_self, __pyx_v_vars, __pyx_v_options, __pyx_v_in_scoping);

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

/* "mathics/core/expression.py":2068
 * 
 *     def replace_vars(self, vars, options={}, in_scoping=True):
 *         assert all(fully_qualified_symbol_name(v) for v in vars)             # <<<<<<<<<<<<<<
 *         var = vars.get(self.name, None)
 *         if var is None:
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_12replace_vars_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_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_7mathics_4core_10expression___pyx_scope_struct_28_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_28_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_28_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2068, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *) __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_7mathics_4core_10expression_6Symbol_12replace_vars_2generator13, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Symbol_replace_vars_locals_genex, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.replace_vars.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_7mathics_4core_10expression_6Symbol_12replace_vars_2generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2068, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_vars)) { __Pyx_RaiseClosureNameError("vars"); __PYX_ERR(0, 2068, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_vars)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_vars)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_vars; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_vars); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2068, __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, 2068, __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, 2068, __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, 2068, __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, 2068, __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, 2068, __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, 2068, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_fully_qualified_symbol_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_v_v) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = ((!__pyx_t_7) != 0);
    if (__pyx_t_8) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

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

/* "mathics/core/expression.py":2067
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name
 * 
 *     def replace_vars(self, vars, options={}, in_scoping=True):             # <<<<<<<<<<<<<<
 *         assert all(fully_qualified_symbol_name(v) for v in vars)
 *         var = vars.get(self.name, None)
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_28replace_vars(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_vars, CYTHON_UNUSED PyObject *__pyx_v_options, CYTHON_UNUSED PyObject *__pyx_v_in_scoping) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *__pyx_cur_scope;
  PyObject *__pyx_v_var = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace_vars", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2067, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_vars = __pyx_v_vars;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_vars);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_vars);

  /* "mathics/core/expression.py":2068
 * 
 *     def replace_vars(self, vars, options={}, in_scoping=True):
 *         assert all(fully_qualified_symbol_name(v) for v in vars)             # <<<<<<<<<<<<<<
 *         var = vars.get(self.name, None)
 *         if var is None:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_6Symbol_12replace_vars_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2068, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 2068, __pyx_L1_error)
    }
  }
  #endif

  /* "mathics/core/expression.py":2069
 *     def replace_vars(self, vars, options={}, in_scoping=True):
 *         assert all(fully_qualified_symbol_name(v) for v in vars)
 *         var = vars.get(self.name, None)             # <<<<<<<<<<<<<<
 *         if var is None:
 *             return self
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_vars, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, Py_None};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, Py_None};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, Py_None);
    __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_var = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2070
 *         assert all(fully_qualified_symbol_name(v) for v in vars)
 *         var = vars.get(self.name, None)
 *         if var is None:             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
  __pyx_t_3 = (__pyx_v_var == Py_None);
  __pyx_t_8 = (__pyx_t_3 != 0);
  if (__pyx_t_8) {

    /* "mathics/core/expression.py":2071
 *         var = vars.get(self.name, None)
 *         if var is None:
 *             return self             # <<<<<<<<<<<<<<
 *         else:
 *             return var
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_self);
    __pyx_r = __pyx_v_self;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2070
 *         assert all(fully_qualified_symbol_name(v) for v in vars)
 *         var = vars.get(self.name, None)
 *         if var is None:             # <<<<<<<<<<<<<<
 *             return self
 *         else:
 */
  }

  /* "mathics/core/expression.py":2073
 *             return self
 *         else:
 *             return var             # <<<<<<<<<<<<<<
 * 
 *     def has_symbol(self, symbol_name) -> bool:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_var);
    __pyx_r = __pyx_v_var;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2067
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name
 * 
 *     def replace_vars(self, vars, options={}, in_scoping=True):             # <<<<<<<<<<<<<<
 *         assert all(fully_qualified_symbol_name(v) for v in vars)
 *         var = vars.get(self.name, None)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.replace_vars", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_var);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2075
 *             return var
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         return self.name == ensure_context(symbol_name)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_31has_symbol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_31has_symbol = {"has_symbol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_31has_symbol, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_31has_symbol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_symbol_name = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("has_symbol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_symbol_name,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_symbol_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("has_symbol", 1, 2, 2, 1); __PYX_ERR(0, 2075, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "has_symbol") < 0)) __PYX_ERR(0, 2075, __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_symbol_name = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("has_symbol", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2075, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.has_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_30has_symbol(__pyx_self, __pyx_v_self, __pyx_v_symbol_name);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_30has_symbol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_symbol_name) {
  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("has_symbol", 0);

  /* "mathics/core/expression.py":2076
 * 
 *     def has_symbol(self, symbol_name) -> bool:
 *         return self.name == ensure_context(symbol_name)             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ensure_context); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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_symbol_name) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_symbol_name);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2075
 *             return var
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         return self.name == ensure_context(symbol_name)
 * 
 */

  /* 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("mathics.core.expression.Symbol.has_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2078
 *         return self.name == ensure_context(symbol_name)
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         rules = evaluation.definitions.get_ownvalues(self.name)
 *         for rule in rules:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_33evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_33evaluate = {"evaluate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_33evaluate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_33evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); __PYX_ERR(0, 2078, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) __PYX_ERR(0, 2078, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2078, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_32evaluate(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_32evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_rules = NULL;
  PyObject *__pyx_v_rule = NULL;
  PyObject *__pyx_v_result = 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;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate", 0);

  /* "mathics/core/expression.py":2079
 * 
 *     def evaluate(self, evaluation):
 *         rules = evaluation.definitions.get_ownvalues(self.name)             # <<<<<<<<<<<<<<
 *         for rule in rules:
 *             result = rule.apply(self, evaluation, fully=True)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_ownvalues); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_rules = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2080
 *     def evaluate(self, evaluation):
 *         rules = evaluation.definitions.get_ownvalues(self.name)
 *         for rule in rules:             # <<<<<<<<<<<<<<
 *             result = rule.apply(self, evaluation, fully=True)
 *             if result is not None and not result.sameQ(self):
 */
  if (likely(PyList_CheckExact(__pyx_v_rules)) || PyTuple_CheckExact(__pyx_v_rules)) {
    __pyx_t_1 = __pyx_v_rules; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_rules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2080, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2080, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2080, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2080, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_5 >= 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_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 2080, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2080, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_6(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 2080, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_rule, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":2081
 *         rules = evaluation.definitions.get_ownvalues(self.name)
 *         for rule in rules:
 *             result = rule.apply(self, evaluation, fully=True)             # <<<<<<<<<<<<<<
 *             if result is not None and not result.sameQ(self):
 *                 return result.evaluate(evaluation)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_rule, __pyx_n_s_apply); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_evaluation);
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_fully, Py_True) < 0) __PYX_ERR(0, 2081, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2081, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "mathics/core/expression.py":2082
 *         for rule in rules:
 *             result = rule.apply(self, evaluation, fully=True)
 *             if result is not None and not result.sameQ(self):             # <<<<<<<<<<<<<<
 *                 return result.evaluate(evaluation)
 *         return self
 */
    __pyx_t_9 = (__pyx_v_result != Py_None);
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (__pyx_t_10) {
    } else {
      __pyx_t_8 = __pyx_t_10;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_7 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_v_self) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_self);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2082, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_9 = ((!__pyx_t_10) != 0);
    __pyx_t_8 = __pyx_t_9;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_8) {

      /* "mathics/core/expression.py":2083
 *             result = rule.apply(self, evaluation, fully=True)
 *             if result is not None and not result.sameQ(self):
 *                 return result.evaluate(evaluation)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2083, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_7 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_evaluation);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2083, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2082
 *         for rule in rules:
 *             result = rule.apply(self, evaluation, fully=True)
 *             if result is not None and not result.sameQ(self):             # <<<<<<<<<<<<<<
 *                 return result.evaluate(evaluation)
 *         return self
 */
    }

    /* "mathics/core/expression.py":2080
 *     def evaluate(self, evaluation):
 *         rules = evaluation.definitions.get_ownvalues(self.name)
 *         for rule in rules:             # <<<<<<<<<<<<<<
 *             result = rule.apply(self, evaluation, fully=True)
 *             if result is not None and not result.sameQ(self):
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2084
 *             if result is not None and not result.sameQ(self):
 *                 return result.evaluate(evaluation)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def is_true(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2078
 *         return self.name == ensure_context(symbol_name)
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         rules = evaluation.definitions.get_ownvalues(self.name)
 *         for rule in rules:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rules);
  __Pyx_XDECREF(__pyx_v_rule);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2086
 *         return self
 * 
 *     def is_true(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self == SymbolTrue
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_35is_true(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_35is_true = {"is_true", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6Symbol_35is_true, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_35is_true(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_true (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_34is_true(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2087
 * 
 *     def is_true(self) -> bool:
 *         return self == SymbolTrue             # <<<<<<<<<<<<<<
 * 
 *     def is_numeric(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SymbolTrue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_self, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2087, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2086
 *         return self
 * 
 *     def is_true(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self == SymbolTrue
 * 
 */

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

/* "mathics/core/expression.py":2089
 *         return self == SymbolTrue
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.name in system_symbols(
 *             "Pi", "E", "EulerGamma", "GoldenRatio", "MachinePrecision", "Catalan"
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_37is_numeric(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_37is_numeric = {"is_numeric", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6Symbol_37is_numeric, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_37is_numeric(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_numeric (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_36is_numeric(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2090
 * 
 *     def is_numeric(self) -> bool:
 *         return self.name in system_symbols(             # <<<<<<<<<<<<<<
 *             "Pi", "E", "EulerGamma", "GoldenRatio", "MachinePrecision", "Catalan"
 *         )
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_system_symbols); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__72, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2090, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2089
 *         return self == SymbolTrue
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.name in system_symbols(
 *             "Pi", "E", "EulerGamma", "GoldenRatio", "MachinePrecision", "Catalan"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.is_numeric", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2094
 *         )
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Symbol", self.name))  # to distinguish from String
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_39__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_39__hash__ = {"__hash__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6Symbol_39__hash__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_39__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_38__hash__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2095
 * 
 *     def __hash__(self):
 *         return hash(("Symbol", self.name))  # to distinguish from String             # <<<<<<<<<<<<<<
 * 
 *     def user_hash(self, update) -> None:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_Symbol);
  __Pyx_GIVEREF(__pyx_n_u_Symbol);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_Symbol);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_Hash(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_hash_t)-1))) __PYX_ERR(0, 2095, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_FromHash_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2094
 *         )
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Symbol", self.name))  # to distinguish from String
 * 
 */

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

/* "mathics/core/expression.py":2097
 *         return hash(("Symbol", self.name))  # to distinguish from String
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(b"System`Symbol>" + self.name.encode("utf8"))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_41user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_41user_hash = {"user_hash", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6Symbol_41user_hash, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_41user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_update = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("user_hash (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_update,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_update)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, 1); __PYX_ERR(0, 2097, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "user_hash") < 0)) __PYX_ERR(0, 2097, __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_update = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2097, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Symbol.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_40user_hash(__pyx_self, __pyx_v_self, __pyx_v_update);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Symbol_40user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update) {
  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("user_hash", 0);

  /* "mathics/core/expression.py":2098
 * 
 *     def user_hash(self, update) -> None:
 *         update(b"System`Symbol>" + self.name.encode("utf8"))             # <<<<<<<<<<<<<<
 * 
 *     def __getnewargs__(self):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_n_u_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_u_utf8);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_kp_b_System_Symbol, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_v_update);
  __pyx_t_2 = __pyx_v_update; __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, 2098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2097
 *         return hash(("Symbol", self.name))  # to distinguish from String
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(b"System`Symbol>" + self.name.encode("utf8"))
 * 
 */

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

/* "mathics/core/expression.py":2100
 *         update(b"System`Symbol>" + self.name.encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.name, self.sympy_dummy)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_43__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Symbol_43__getnewargs__ = {"__getnewargs__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6Symbol_43__getnewargs__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Symbol_43__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getnewargs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Symbol_42__getnewargs__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2101
 * 
 *     def __getnewargs__(self):
 *         return (self.name, self.sympy_dummy)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sympy_dummy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2101, __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;

  /* "mathics/core/expression.py":2100
 *         update(b"System`Symbol>" + self.name.encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.name, self.sympy_dummy)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Symbol.__getnewargs__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2124
 * 
 * @lru_cache(maxsize=1024)
 * def from_mpmath(value, prec=None):             # <<<<<<<<<<<<<<
 *     "Converts mpf or mpc to Number."
 *     if isinstance(value, mpmath.mpf):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_15from_mpmath(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_14from_mpmath[] = "Converts mpf or mpc to Number.";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_15from_mpmath = {"from_mpmath", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_15from_mpmath, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_14from_mpmath};
static PyObject *__pyx_pw_7mathics_4core_10expression_15from_mpmath(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_prec = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("from_mpmath (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,&__pyx_n_s_prec,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 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_prec);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "from_mpmath") < 0)) __PYX_ERR(0, 2124, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_value = values[0];
    __pyx_v_prec = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("from_mpmath", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2124, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.from_mpmath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_14from_mpmath(__pyx_self, __pyx_v_value, __pyx_v_prec);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_14from_mpmath(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value, PyObject *__pyx_v_prec) {
  PyObject *__pyx_v_real = NULL;
  PyObject *__pyx_v_imag = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("from_mpmath", 0);

  /* "mathics/core/expression.py":2126
 * def from_mpmath(value, prec=None):
 *     "Converts mpf or mpc to Number."
 *     if isinstance(value, mpmath.mpf):             # <<<<<<<<<<<<<<
 *         if prec is None:
 *             return MachineReal(float(value))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_mpf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2126, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2127
 *     "Converts mpf or mpc to Number."
 *     if isinstance(value, mpmath.mpf):
 *         if prec is None:             # <<<<<<<<<<<<<<
 *             return MachineReal(float(value))
 *         else:
 */
    __pyx_t_4 = (__pyx_v_prec == Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {

      /* "mathics/core/expression.py":2128
 *     if isinstance(value, mpmath.mpf):
 *         if prec is None:
 *             return MachineReal(float(value))             # <<<<<<<<<<<<<<
 *         else:
 *             # HACK: use str here to prevent loss of precision
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyNumber_Float(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __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_2)) __PYX_ERR(0, 2128, __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;

      /* "mathics/core/expression.py":2127
 *     "Converts mpf or mpc to Number."
 *     if isinstance(value, mpmath.mpf):
 *         if prec is None:             # <<<<<<<<<<<<<<
 *             return MachineReal(float(value))
 *         else:
 */
    }

    /* "mathics/core/expression.py":2131
 *         else:
 *             # HACK: use str here to prevent loss of precision
 *             return PrecisionReal(sympy.Float(str(value), prec))             # <<<<<<<<<<<<<<
 *     elif isinstance(value, mpmath.mpc):
 *         if value.imag == 0.0:
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PrecisionReal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_sympy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Float); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = NULL;
      __pyx_t_9 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_9 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_v_prec};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2131, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_6, __pyx_v_prec};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2131, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2131, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_8) {
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_6);
        __Pyx_INCREF(__pyx_v_prec);
        __Pyx_GIVEREF(__pyx_v_prec);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_prec);
        __pyx_t_6 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2131, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2131, __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;
    }

    /* "mathics/core/expression.py":2126
 * def from_mpmath(value, prec=None):
 *     "Converts mpf or mpc to Number."
 *     if isinstance(value, mpmath.mpf):             # <<<<<<<<<<<<<<
 *         if prec is None:
 *             return MachineReal(float(value))
 */
  }

  /* "mathics/core/expression.py":2132
 *             # HACK: use str here to prevent loss of precision
 *             return PrecisionReal(sympy.Float(str(value), prec))
 *     elif isinstance(value, mpmath.mpc):             # <<<<<<<<<<<<<<
 *         if value.imag == 0.0:
 *             return from_mpmath(value.real, prec)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mpc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2132, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (likely(__pyx_t_4)) {

    /* "mathics/core/expression.py":2133
 *             return PrecisionReal(sympy.Float(str(value), prec))
 *     elif isinstance(value, mpmath.mpc):
 *         if value.imag == 0.0:             # <<<<<<<<<<<<<<
 *             return from_mpmath(value.real, prec)
 *         real = from_mpmath(value.real, prec)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_imag); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyFloat_EqObjC(__pyx_t_1, __pyx_float_0_0, 0.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2133, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":2134
 *     elif isinstance(value, mpmath.mpc):
 *         if value.imag == 0.0:
 *             return from_mpmath(value.real, prec)             # <<<<<<<<<<<<<<
 *         real = from_mpmath(value.real, prec)
 *         imag = from_mpmath(value.imag, prec)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_from_mpmath); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_real); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = NULL;
      __pyx_t_9 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_9 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_v_prec};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2134, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_v_prec};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2134, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
        __Pyx_INCREF(__pyx_v_prec);
        __Pyx_GIVEREF(__pyx_v_prec);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_prec);
        __pyx_t_5 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2133
 *             return PrecisionReal(sympy.Float(str(value), prec))
 *     elif isinstance(value, mpmath.mpc):
 *         if value.imag == 0.0:             # <<<<<<<<<<<<<<
 *             return from_mpmath(value.real, prec)
 *         real = from_mpmath(value.real, prec)
 */
    }

    /* "mathics/core/expression.py":2135
 *         if value.imag == 0.0:
 *             return from_mpmath(value.real, prec)
 *         real = from_mpmath(value.real, prec)             # <<<<<<<<<<<<<<
 *         imag = from_mpmath(value.imag, prec)
 *         return Complex(real, imag)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_from_mpmath); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_real); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_10, __pyx_v_prec};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2135, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_10, __pyx_v_prec};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2135, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_t_10);
      __Pyx_INCREF(__pyx_v_prec);
      __Pyx_GIVEREF(__pyx_v_prec);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_v_prec);
      __pyx_t_10 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2135, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_real = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":2136
 *             return from_mpmath(value.real, prec)
 *         real = from_mpmath(value.real, prec)
 *         imag = from_mpmath(value.imag, prec)             # <<<<<<<<<<<<<<
 *         return Complex(real, imag)
 *     else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_from_mpmath); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_imag); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_7, __pyx_v_prec};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2136, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_7, __pyx_v_prec};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2136, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2136, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_t_7);
      __Pyx_INCREF(__pyx_v_prec);
      __Pyx_GIVEREF(__pyx_v_prec);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_v_prec);
      __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2136, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_imag = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":2137
 *         real = from_mpmath(value.real, prec)
 *         imag = from_mpmath(value.imag, prec)
 *         return Complex(real, imag)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError(type(value))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Complex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_real, __pyx_v_imag};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2137, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_real, __pyx_v_imag};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2137, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2137, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_real);
      __Pyx_GIVEREF(__pyx_v_real);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, __pyx_v_real);
      __Pyx_INCREF(__pyx_v_imag);
      __Pyx_GIVEREF(__pyx_v_imag);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_v_imag);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2137, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2132
 *             # HACK: use str here to prevent loss of precision
 *             return PrecisionReal(sympy.Float(str(value), prec))
 *     elif isinstance(value, mpmath.mpc):             # <<<<<<<<<<<<<<
 *         if value.imag == 0.0:
 *             return from_mpmath(value.real, prec)
 */
  }

  /* "mathics/core/expression.py":2139
 *         return Complex(real, imag)
 *     else:
 *         raise TypeError(type(value))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, ((PyObject *)Py_TYPE(__pyx_v_value))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2139, __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, 2139, __pyx_L1_error)
  }

  /* "mathics/core/expression.py":2124
 * 
 * @lru_cache(maxsize=1024)
 * def from_mpmath(value, prec=None):             # <<<<<<<<<<<<<<
 *     "Converts mpf or mpc to Number."
 *     if isinstance(value, mpmath.mpf):
 */

  /* 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_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.from_mpmath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_real);
  __Pyx_XDECREF(__pyx_v_imag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2143
 * 
 * class Number(Atom):
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Number_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Number_1__str__ = {"__str__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6Number_1__str__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Number_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Number___str__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2144
 * class Number(Atom):
 *     def __str__(self) -> str:
 *         return str(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def is_numeric(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2143
 * 
 * class Number(Atom):
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */

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

/* "mathics/core/expression.py":2146
 *         return str(self.value)
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6Number_3is_numeric(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6Number_3is_numeric = {"is_numeric", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6Number_3is_numeric, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6Number_3is_numeric(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_numeric (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6Number_2is_numeric(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6Number_2is_numeric(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_numeric", 0);

  /* "mathics/core/expression.py":2147
 * 
 *     def is_numeric(self) -> bool:
 *         return True             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2146
 *         return str(self.value)
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */

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

/* "mathics/core/expression.py":2150
 * 
 * 
 * def _ExponentFunction(value):             # <<<<<<<<<<<<<<
 *     n = value.get_int_value()
 *     if -5 <= n <= 5:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_17_ExponentFunction(PyObject *__pyx_self, PyObject *__pyx_v_value); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_17_ExponentFunction = {"_ExponentFunction", (PyCFunction)__pyx_pw_7mathics_4core_10expression_17_ExponentFunction, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_17_ExponentFunction(PyObject *__pyx_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_ExponentFunction (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_16_ExponentFunction(__pyx_self, ((PyObject *)__pyx_v_value));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_16_ExponentFunction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_ExponentFunction", 0);

  /* "mathics/core/expression.py":2151
 * 
 * def _ExponentFunction(value):
 *     n = value.get_int_value()             # <<<<<<<<<<<<<<
 *     if -5 <= n <= 5:
 *         return SymbolNull
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2151, __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, 2151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_n = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2152
 * def _ExponentFunction(value):
 *     n = value.get_int_value()
 *     if -5 <= n <= 5:             # <<<<<<<<<<<<<<
 *         return SymbolNull
 *     else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_int_neg_5, __pyx_v_n, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2152, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_n, __pyx_int_5, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2152, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2152, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2153
 *     n = value.get_int_value()
 *     if -5 <= n <= 5:
 *         return SymbolNull             # <<<<<<<<<<<<<<
 *     else:
 *         return value
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SymbolNull); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2153, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2152
 * def _ExponentFunction(value):
 *     n = value.get_int_value()
 *     if -5 <= n <= 5:             # <<<<<<<<<<<<<<
 *         return SymbolNull
 *     else:
 */
  }

  /* "mathics/core/expression.py":2155
 *         return SymbolNull
 *     else:
 *         return value             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_value);
    __pyx_r = __pyx_v_value;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2150
 * 
 * 
 * def _ExponentFunction(value):             # <<<<<<<<<<<<<<
 *     n = value.get_int_value()
 *     if -5 <= n <= 5:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression._ExponentFunction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2158
 * 
 * 
 * def _NumberFormat(man, base, exp, options):             # <<<<<<<<<<<<<<
 *     if exp.get_string_value():
 *         if options["_Form"] in (
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_19_NumberFormat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_19_NumberFormat = {"_NumberFormat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_19_NumberFormat, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_19_NumberFormat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_man = 0;
  PyObject *__pyx_v_base = 0;
  PyObject *__pyx_v_exp = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_NumberFormat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_man,&__pyx_n_s_base,&__pyx_n_s_exp,&__pyx_n_s_options,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_man)) != 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_base)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_NumberFormat", 1, 4, 4, 1); __PYX_ERR(0, 2158, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_NumberFormat", 1, 4, 4, 2); __PYX_ERR(0, 2158, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_NumberFormat", 1, 4, 4, 3); __PYX_ERR(0, 2158, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_NumberFormat") < 0)) __PYX_ERR(0, 2158, __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_man = values[0];
    __pyx_v_base = values[1];
    __pyx_v_exp = values[2];
    __pyx_v_options = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_NumberFormat", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2158, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression._NumberFormat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_18_NumberFormat(__pyx_self, __pyx_v_man, __pyx_v_base, __pyx_v_exp, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_18_NumberFormat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_man, PyObject *__pyx_v_base, PyObject *__pyx_v_exp, PyObject *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_NumberFormat", 0);

  /* "mathics/core/expression.py":2159
 * 
 * def _NumberFormat(man, base, exp, options):
 *     if exp.get_string_value():             # <<<<<<<<<<<<<<
 *         if options["_Form"] in (
 *             "System`InputForm",
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_exp, __pyx_n_s_get_string_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2159, __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, 2159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2160
 * def _NumberFormat(man, base, exp, options):
 *     if exp.get_string_value():
 *         if options["_Form"] in (             # <<<<<<<<<<<<<<
 *             "System`InputForm",
 *             "System`OutputForm",
 */
    __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_options, __pyx_n_u_Form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2160, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_InputForm, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2160, __pyx_L1_error)
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_OutputForm, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2160, __pyx_L1_error)
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u_System_FullForm, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2160, __pyx_L1_error)
    __pyx_t_4 = __pyx_t_5;
    __pyx_L5_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = (__pyx_t_4 != 0);
    if (__pyx_t_5) {

      /* "mathics/core/expression.py":2165
 *             "System`FullForm",
 *         ):
 *             return Expression("RowBox", Expression(SymbolList, man, String("*^"), exp))             # <<<<<<<<<<<<<<
 *         else:
 *             return Expression(
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Expression); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_String); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_kp_u__73) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_kp_u__73);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2165, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_t_7, __pyx_v_man, __pyx_t_8, __pyx_v_exp};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2165, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_t_7, __pyx_v_man, __pyx_t_8, __pyx_v_exp};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2165, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2165, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_11, __pyx_t_7);
        __Pyx_INCREF(__pyx_v_man);
        __Pyx_GIVEREF(__pyx_v_man);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_11, __pyx_v_man);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_11, __pyx_t_8);
        __Pyx_INCREF(__pyx_v_exp);
        __Pyx_GIVEREF(__pyx_v_exp);
        PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_11, __pyx_v_exp);
        __pyx_t_7 = 0;
        __pyx_t_8 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2165, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_n_u_RowBox, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2165, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_n_u_RowBox, __pyx_t_3};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2165, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2165, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_INCREF(__pyx_n_u_RowBox);
        __Pyx_GIVEREF(__pyx_n_u_RowBox);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_11, __pyx_n_u_RowBox);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_11, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2165, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2160
 * def _NumberFormat(man, base, exp, options):
 *     if exp.get_string_value():
 *         if options["_Form"] in (             # <<<<<<<<<<<<<<
 *             "System`InputForm",
 *             "System`OutputForm",
 */
    }

    /* "mathics/core/expression.py":2167
 *             return Expression("RowBox", Expression(SymbolList, man, String("*^"), exp))
 *         else:
 *             return Expression(             # <<<<<<<<<<<<<<
 *                 "RowBox",
 *                 Expression(
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "mathics/core/expression.py":2169
 *             return Expression(
 *                 "RowBox",
 *                 Expression(             # <<<<<<<<<<<<<<
 *                     "List",
 *                     man,
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2169, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);

      /* "mathics/core/expression.py":2172
 *                     "List",
 *                     man,
 *                     String(options["NumberMultiplier"]),             # <<<<<<<<<<<<<<
 *                     Expression("SuperscriptBox", base, exp),
 *                 ),
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_String); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_v_options, __pyx_n_u_NumberMultiplier); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(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_6 = (__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_6)) __PYX_ERR(0, 2172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "mathics/core/expression.py":2173
 *                     man,
 *                     String(options["NumberMultiplier"]),
 *                     Expression("SuperscriptBox", base, exp),             # <<<<<<<<<<<<<<
 *                 ),
 *             )
 */
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Expression); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_n_u_SuperscriptBox, __pyx_v_base, __pyx_v_exp};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_n_u_SuperscriptBox, __pyx_v_base, __pyx_v_exp};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_n_u_SuperscriptBox);
        __Pyx_GIVEREF(__pyx_n_u_SuperscriptBox);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_n_u_SuperscriptBox);
        __Pyx_INCREF(__pyx_v_base);
        __Pyx_GIVEREF(__pyx_v_base);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_base);
        __Pyx_INCREF(__pyx_v_exp);
        __Pyx_GIVEREF(__pyx_v_exp);
        PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_v_exp);
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_n_u_List, __pyx_v_man, __pyx_t_6, __pyx_t_8};
        __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2169, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_n_u_List, __pyx_v_man, __pyx_t_6, __pyx_t_8};
        __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 4+__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2169, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(4+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2169, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_n_u_List);
        __Pyx_GIVEREF(__pyx_n_u_List);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_n_u_List);
        __Pyx_INCREF(__pyx_v_man);
        __Pyx_GIVEREF(__pyx_v_man);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_v_man);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_t_8);
        __pyx_t_6 = 0;
        __pyx_t_8 = 0;
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2169, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_11 = 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_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_RowBox, __pyx_t_10};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2167, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_RowBox, __pyx_t_10};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2167, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2167, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(__pyx_n_u_RowBox);
        __Pyx_GIVEREF(__pyx_n_u_RowBox);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_n_u_RowBox);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2167, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;
    }

    /* "mathics/core/expression.py":2159
 * 
 * def _NumberFormat(man, base, exp, options):
 *     if exp.get_string_value():             # <<<<<<<<<<<<<<
 *         if options["_Form"] in (
 *             "System`InputForm",
 */
  }

  /* "mathics/core/expression.py":2177
 *             )
 *     else:
 *         return man             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_man);
    __pyx_r = __pyx_v_man;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2158
 * 
 * 
 * def _NumberFormat(man, base, exp, options):             # <<<<<<<<<<<<<<
 *     if exp.get_string_value():
 *         if options["_Form"] in (
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("mathics.core.expression._NumberFormat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2196
 *     value: int
 * 
 *     def __new__(cls, value) -> "Integer":             # <<<<<<<<<<<<<<
 *         n = int(value)
 *         self = super(Integer, cls).__new__(cls)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, 1); __PYX_ERR(0, 2196, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 2196, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_cls = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2196, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Integer.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer___new__(__pyx_self, __pyx_v_cls, __pyx_v_value);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_v_self = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);

  /* "mathics/core/expression.py":2197
 * 
 *     def __new__(cls, value) -> "Integer":
 *         n = int(value)             # <<<<<<<<<<<<<<
 *         self = super(Integer, cls).__new__(cls)
 *         self.value = n
 */
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_n = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2198
 *     def __new__(cls, value) -> "Integer":
 *         n = int(value)
 *         self = super(Integer, cls).__new__(cls)             # <<<<<<<<<<<<<<
 *         self.value = n
 *         return self
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_cls);
  __Pyx_GIVEREF(__pyx_v_cls);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cls);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_cls) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cls);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2199
 *         n = int(value)
 *         self = super(Integer, cls).__new__(cls)
 *         self.value = n             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_v_n) < 0) __PYX_ERR(0, 2199, __pyx_L1_error)

  /* "mathics/core/expression.py":2200
 *         self = super(Integer, cls).__new__(cls)
 *         self.value = n
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     @lru_cache()
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2196
 *     value: int
 * 
 *     def __new__(cls, value) -> "Integer":             # <<<<<<<<<<<<<<
 *         n = int(value)
 *         self = super(Integer, cls).__new__(cls)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Integer.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2203
 * 
 *     @lru_cache()
 *     def __init__(self, value) -> "Integer":             # <<<<<<<<<<<<<<
 *         super().__init__()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_3__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_3__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_3__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_3__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_value = 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_value,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_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 2203, __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, 2203, __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_value = 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, 2203, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Integer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_2__init__(__pyx_self, __pyx_v_self, __pyx_v_value);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_2__init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_value) {
  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("__init__", 0);

  /* "mathics/core/expression.py":2204
 *     @lru_cache()
 *     def __init__(self, value) -> "Integer":
 *         super().__init__()             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_text(self, **options) -> str:
 */
  __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 2204, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2203
 * 
 *     @lru_cache()
 *     def __init__(self, value) -> "Integer":             # <<<<<<<<<<<<<<
 *         super().__init__()
 * 
 */

  /* 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("mathics.core.expression.Integer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2206
 *         super().__init__()
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_5boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_5boxes_to_text = {"boxes_to_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_5boxes_to_text, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_5boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_text (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_text") < 0)) __PYX_ERR(0, 2206, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_text", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2206, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.Integer.boxes_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_4boxes_to_text(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_4boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options) {
  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("boxes_to_text", 0);

  /* "mathics/core/expression.py":2207
 * 
 *     def boxes_to_text(self, **options) -> str:
 *         return str(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_mathml(self, **options) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2206
 *         super().__init__()
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */

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

/* "mathics/core/expression.py":2209
 *         return str(self.value)
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("MathMLForm").boxes_to_mathml(**options)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_7boxes_to_mathml(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_7boxes_to_mathml = {"boxes_to_mathml", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_7boxes_to_mathml, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_7boxes_to_mathml(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_mathml (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_mathml") < 0)) __PYX_ERR(0, 2209, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_mathml", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2209, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.Integer.boxes_to_mathml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_6boxes_to_mathml(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_6boxes_to_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options) {
  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("boxes_to_mathml", 0);

  /* "mathics/core/expression.py":2210
 * 
 *     def boxes_to_mathml(self, **options) -> str:
 *         return self.make_boxes("MathMLForm").boxes_to_mathml(**options)             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_tex(self, **options) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_boxes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2210, __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_n_u_MathMLForm) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_MathMLForm);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_v_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2210, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2209
 *         return str(self.value)
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("MathMLForm").boxes_to_mathml(**options)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Integer.boxes_to_mathml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2212
 *         return self.make_boxes("MathMLForm").boxes_to_mathml(**options)
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_9boxes_to_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_9boxes_to_tex = {"boxes_to_tex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_9boxes_to_tex, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_9boxes_to_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_tex (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_tex") < 0)) __PYX_ERR(0, 2212, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_tex", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2212, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.Integer.boxes_to_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_8boxes_to_tex(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_8boxes_to_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options) {
  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("boxes_to_tex", 0);

  /* "mathics/core/expression.py":2213
 * 
 *     def boxes_to_tex(self, **options) -> str:
 *         return str(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def make_boxes(self, form) -> "String":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2212
 *         return self.make_boxes("MathMLForm").boxes_to_mathml(**options)
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */

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

/* "mathics/core/expression.py":2215
 *         return str(self.value)
 * 
 *     def make_boxes(self, form) -> "String":             # <<<<<<<<<<<<<<
 *         return String(str(self.value))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_11make_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_11make_boxes = {"make_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_11make_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_11make_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_form,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_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("make_boxes", 1, 2, 2, 1); __PYX_ERR(0, 2215, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "make_boxes") < 0)) __PYX_ERR(0, 2215, __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_form = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("make_boxes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2215, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Integer.make_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_10make_boxes(__pyx_self, __pyx_v_self, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_10make_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_form) {
  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("make_boxes", 0);

  /* "mathics/core/expression.py":2216
 * 
 *     def make_boxes(self, form) -> "String":
 *         return String(str(self.value))             # <<<<<<<<<<<<<<
 * 
 *     def atom_to_boxes(self, f, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_String); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2216, __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, 2216, __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;

  /* "mathics/core/expression.py":2215
 *         return str(self.value)
 * 
 *     def make_boxes(self, form) -> "String":             # <<<<<<<<<<<<<<
 *         return String(str(self.value))
 * 
 */

  /* 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("mathics.core.expression.Integer.make_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2218
 *         return String(str(self.value))
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.make_boxes(f.get_name())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_13atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_13atom_to_boxes = {"atom_to_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_13atom_to_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_13atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_f = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atom_to_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_f,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 1); __PYX_ERR(0, 2218, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 2); __PYX_ERR(0, 2218, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atom_to_boxes") < 0)) __PYX_ERR(0, 2218, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_f = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2218, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Integer.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_12atom_to_boxes(__pyx_self, __pyx_v_self, __pyx_v_f, __pyx_v_evaluation);

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

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

  /* "mathics/core/expression.py":2219
 * 
 *     def atom_to_boxes(self, f, evaluation):
 *         return self.make_boxes(f.get_name())             # <<<<<<<<<<<<<<
 * 
 *     def default_format(self, evaluation, form) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_boxes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_get_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2219, __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, 2219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2219, __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;

  /* "mathics/core/expression.py":2218
 *         return String(str(self.value))
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.make_boxes(f.get_name())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Integer.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2221
 *         return self.make_boxes(f.get_name())
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_15default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_15default_format = {"default_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_15default_format, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_15default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  CYTHON_UNUSED PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 1); __PYX_ERR(0, 2221, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 2); __PYX_ERR(0, 2221, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_format") < 0)) __PYX_ERR(0, 2221, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2221, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Integer.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_14default_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_14default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation, CYTHON_UNUSED PyObject *__pyx_v_form) {
  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("default_format", 0);

  /* "mathics/core/expression.py":2222
 * 
 *     def default_format(self, evaluation, form) -> str:
 *         return str(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def to_sympy(self, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2221
 *         return self.make_boxes(f.get_name())
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */

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

/* "mathics/core/expression.py":2224
 *         return str(self.value)
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return sympy.Integer(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_17to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_17to_sympy = {"to_sympy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_17to_sympy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_17to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED 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("to_sympy (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "to_sympy") < 0)) __PYX_ERR(0, 2224, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_sympy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2224, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.Integer.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_16to_sympy(__pyx_self, __pyx_v_self, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_16to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  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("to_sympy", 0);

  /* "mathics/core/expression.py":2225
 * 
 *     def to_sympy(self, **kwargs):
 *         return sympy.Integer(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def to_mpmath(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2225, __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;

  /* "mathics/core/expression.py":2224
 *         return str(self.value)
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return sympy.Integer(self.value)
 * 
 */

  /* 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("mathics.core.expression.Integer.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2227
 *         return sympy.Integer(self.value)
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_19to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_19to_mpmath = {"to_mpmath", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Integer_19to_mpmath, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_19to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_mpmath (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_18to_mpmath(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2228
 * 
 *     def to_mpmath(self):
 *         return mpmath.mpf(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def to_python(self, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mpf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2228, __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;

  /* "mathics/core/expression.py":2227
 *         return sympy.Integer(self.value)
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */

  /* 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("mathics.core.expression.Integer.to_mpmath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2230
 *         return mpmath.mpf(self.value)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_21to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_21to_python = {"to_python", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_21to_python, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_21to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED 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("to_python (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_self,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_self)) != 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, "to_python") < 0)) __PYX_ERR(0, 2230, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_python", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2230, __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("mathics.core.expression.Integer.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_20to_python(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_20to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  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("to_python", 0);

  /* "mathics/core/expression.py":2231
 * 
 *     def to_python(self, *args, **kwargs):
 *         return self.value             # <<<<<<<<<<<<<<
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2230
 *         return mpmath.mpf(self.value)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Integer.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2233
 *         return self.value
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_23round(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_23round = {"round", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_23round, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_23round(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_d = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("round (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_d,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "round") < 0)) __PYX_ERR(0, 2233, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("round", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2233, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Integer.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_22round(__pyx_self, __pyx_v_self, __pyx_v_d);

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

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

  /* "mathics/core/expression.py":2234
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 *         if d is None:             # <<<<<<<<<<<<<<
 *             return MachineReal(float(self.value))
 *         else:
 */
  __pyx_t_1 = (__pyx_v_d == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":2235
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 *         if d is None:
 *             return MachineReal(float(self.value))             # <<<<<<<<<<<<<<
 *         else:
 *             return PrecisionReal(sympy.Float(self.value, d))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyNumber_Float(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2235, __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, 2235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2234
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 *         if d is None:             # <<<<<<<<<<<<<<
 *             return MachineReal(float(self.value))
 *         else:
 */
  }

  /* "mathics/core/expression.py":2237
 *             return MachineReal(float(self.value))
 *         else:
 *             return PrecisionReal(sympy.Float(self.value, d))             # <<<<<<<<<<<<<<
 * 
 *     def get_int_value(self) -> int:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_PrecisionReal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sympy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Float); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_5, __pyx_v_d};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2237, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_5, __pyx_v_d};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2237, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2237, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_5);
      __Pyx_INCREF(__pyx_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_d);
      __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2237, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2233
 *         return self.value
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.Integer.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2239
 *             return PrecisionReal(sympy.Float(self.value, d))
 * 
 *     def get_int_value(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_25get_int_value(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_25get_int_value = {"get_int_value", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Integer_25get_int_value, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_25get_int_value(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_int_value (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_24get_int_value(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2240
 * 
 *     def get_int_value(self) -> int:
 *         return self.value             # <<<<<<<<<<<<<<
 * 
 *     def sameQ(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2239
 *             return PrecisionReal(sympy.Float(self.value, d))
 * 
 *     def get_int_value(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Integer.get_int_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2242
 *         return self.value
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, Integer) and self.value == other.value
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_27sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_7Integer_26sameQ[] = "Mathics SameQ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_27sameQ = {"sameQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_27sameQ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_7Integer_26sameQ};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_27sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sameQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, 1); __PYX_ERR(0, 2242, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sameQ") < 0)) __PYX_ERR(0, 2242, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2242, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Integer.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_26sameQ(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":2244
 *     def sameQ(self, other) -> bool:
 *         """Mathics SameQ"""
 *         return isinstance(other, Integer) and self.value == other.value             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_other, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2244, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2244, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2242
 *         return self.value
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, Integer) and self.value == other.value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Integer.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2246
 *         return isinstance(other, Integer) and self.value == other.value
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_29evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_29evaluate = {"evaluate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_29evaluate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_29evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); __PYX_ERR(0, 2246, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) __PYX_ERR(0, 2246, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2246, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Integer.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_28evaluate(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_28evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  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("evaluate", 0);

  /* "mathics/core/expression.py":2247
 * 
 *     def evaluate(self, evaluation):
 *         evaluation.check_stopped()             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_check_stopped); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2247, __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, 2247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2248
 *     def evaluate(self, evaluation):
 *         evaluation.check_stopped()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def get_sort_key(self, pattern_sort=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2246
 *         return isinstance(other, Integer) and self.value == other.value
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Integer.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2250
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_31get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_31get_sort_key = {"get_sort_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_31get_sort_key, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_31get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_pattern_sort = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sort_key (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_pattern_sort,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_sort);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_sort_key") < 0)) __PYX_ERR(0, 2250, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_pattern_sort = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_sort_key", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2250, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Integer.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_30get_sort_key(__pyx_self, __pyx_v_self, __pyx_v_pattern_sort);

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

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

  /* "mathics/core/expression.py":2251
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_sort); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2251, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2252
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:
 *             return super().get_sort_key(True)             # <<<<<<<<<<<<<<
 *         else:
 *             return [0, 0, self.value, 0, 1]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_CyFunction_GetClassObj(__pyx_self);
    if (!__pyx_t_3) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 2252, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2251
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         else:
 */
  }

  /* "mathics/core/expression.py":2254
 *             return super().get_sort_key(True)
 *         else:
 *             return [0, 0, self.value, 0, 1]             # <<<<<<<<<<<<<<
 * 
 *     def do_copy(self) -> "Integer":
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyList_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_4, 3, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_4, 4, __pyx_int_1);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2250
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.Integer.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2256
 *             return [0, 0, self.value, 0, 1]
 * 
 *     def do_copy(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_33do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_33do_copy = {"do_copy", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Integer_33do_copy, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_33do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_32do_copy(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2257
 * 
 *     def do_copy(self) -> "Integer":
 *         return Integer(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2257, __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;

  /* "mathics/core/expression.py":2256
 *             return [0, 0, self.value, 0, 1]
 * 
 *     def do_copy(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value)
 * 
 */

  /* 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("mathics.core.expression.Integer.do_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2259
 *         return Integer(self.value)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Integer", self.value))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_35__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_35__hash__ = {"__hash__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Integer_35__hash__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_35__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_34__hash__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2260
 * 
 *     def __hash__(self):
 *         return hash(("Integer", self.value))             # <<<<<<<<<<<<<<
 * 
 *     def user_hash(self, update):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_Integer);
  __Pyx_GIVEREF(__pyx_n_u_Integer);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_Integer);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_Hash(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_hash_t)-1))) __PYX_ERR(0, 2260, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_FromHash_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2259
 *         return Integer(self.value)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Integer", self.value))
 * 
 */

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

/* "mathics/core/expression.py":2262
 *         return hash(("Integer", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         update(b"System`Integer>" + str(self.value).encode("utf8"))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_37user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_37user_hash = {"user_hash", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Integer_37user_hash, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_37user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_update = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("user_hash (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_update,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_update)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, 1); __PYX_ERR(0, 2262, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "user_hash") < 0)) __PYX_ERR(0, 2262, __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_update = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2262, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Integer.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_36user_hash(__pyx_self, __pyx_v_self, __pyx_v_update);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Integer_36user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update) {
  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("user_hash", 0);

  /* "mathics/core/expression.py":2263
 * 
 *     def user_hash(self, update):
 *         update(b"System`Integer>" + str(self.value).encode("utf8"))             # <<<<<<<<<<<<<<
 * 
 *     def __getnewargs__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_kp_b_System_Integer, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_v_update);
  __pyx_t_2 = __pyx_v_update; __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2262
 *         return hash(("Integer", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         update(b"System`Integer>" + str(self.value).encode("utf8"))
 * 
 */

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

/* "mathics/core/expression.py":2265
 *         update(b"System`Integer>" + str(self.value).encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_39__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_39__getnewargs__ = {"__getnewargs__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Integer_39__getnewargs__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_39__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getnewargs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_38__getnewargs__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2266
 * 
 *     def __getnewargs__(self):
 *         return (self.value,)             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self) -> "Integer":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2266, __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_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2265
 *         update(b"System`Integer>" + str(self.value).encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */

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

/* "mathics/core/expression.py":2268
 *         return (self.value,)
 * 
 *     def __neg__(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(-self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_41__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_41__neg__ = {"__neg__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Integer_41__neg__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_41__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_40__neg__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2269
 * 
 *     def __neg__(self) -> "Integer":
 *         return Integer(-self.value)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2269, __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, 2269, __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;

  /* "mathics/core/expression.py":2268
 *         return (self.value,)
 * 
 *     def __neg__(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(-self.value)
 * 
 */

  /* 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("mathics.core.expression.Integer.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2272
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_43is_zero(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Integer_43is_zero = {"is_zero", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Integer_43is_zero, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Integer_43is_zero(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_zero (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Integer_42is_zero(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2273
 *     @property
 *     def is_zero(self) -> bool:
 *         return self.value == 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2273, __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;

  /* "mathics/core/expression.py":2272
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0
 * 
 */

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

/* "mathics/core/expression.py":2282
 * class Rational(Number):
 *     @lru_cache()
 *     def __new__(cls, numerator, denominator=1) -> "Rational":             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         self.value = sympy.Rational(numerator, denominator)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_numerator = 0;
  PyObject *__pyx_v_denominator = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_numerator,&__pyx_n_s_denominator,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)__pyx_int_1));
    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_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numerator)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 3, 1); __PYX_ERR(0, 2282, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_denominator);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 2282, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_cls = values[0];
    __pyx_v_numerator = values[1];
    __pyx_v_denominator = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2282, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Rational.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational___new__(__pyx_self, __pyx_v_cls, __pyx_v_numerator, __pyx_v_denominator);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_numerator, PyObject *__pyx_v_denominator) {
  PyObject *__pyx_v_self = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);

  /* "mathics/core/expression.py":2283
 *     @lru_cache()
 *     def __new__(cls, numerator, denominator=1) -> "Rational":
 *         self = super().__new__(cls)             # <<<<<<<<<<<<<<
 *         self.value = sympy.Rational(numerator, denominator)
 *         return self
 */
  __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 2283, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_cls);
  __Pyx_GIVEREF(__pyx_v_cls);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cls);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_cls) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cls);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2284
 *     def __new__(cls, numerator, denominator=1) -> "Rational":
 *         self = super().__new__(cls)
 *         self.value = sympy.Rational(numerator, denominator)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sympy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Rational); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __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_numerator, __pyx_v_denominator};
    __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, 2284, __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_numerator, __pyx_v_denominator};
    __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, 2284, __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, 2284, __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_numerator);
    __Pyx_GIVEREF(__pyx_v_numerator);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_numerator);
    __Pyx_INCREF(__pyx_v_denominator);
    __Pyx_GIVEREF(__pyx_v_denominator);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_denominator);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_t_1) < 0) __PYX_ERR(0, 2284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2285
 *         self = super().__new__(cls)
 *         self.value = sympy.Rational(numerator, denominator)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def atom_to_boxes(self, f, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2282
 * class Rational(Number):
 *     @lru_cache()
 *     def __new__(cls, numerator, denominator=1) -> "Rational":             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         self.value = sympy.Rational(numerator, denominator)
 */

  /* 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("mathics.core.expression.Rational.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2287
 *         return self
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.format(evaluation, f.get_name())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_3atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_3atom_to_boxes = {"atom_to_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_3atom_to_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_3atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atom_to_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_f,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 1); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 2); __PYX_ERR(0, 2287, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atom_to_boxes") < 0)) __PYX_ERR(0, 2287, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_f = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2287, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Rational.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_2atom_to_boxes(__pyx_self, __pyx_v_self, __pyx_v_f, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_2atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("atom_to_boxes", 0);

  /* "mathics/core/expression.py":2288
 * 
 *     def atom_to_boxes(self, f, evaluation):
 *         return self.format(evaluation, f.get_name())             # <<<<<<<<<<<<<<
 * 
 *     def to_sympy(self, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_get_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2288, __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, 2288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_evaluation, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2288, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_evaluation, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2288, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2288, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2288, __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;

  /* "mathics/core/expression.py":2287
 *         return self
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.format(evaluation, f.get_name())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Rational.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2290
 *         return self.format(evaluation, f.get_name())
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_5to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_5to_sympy = {"to_sympy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_5to_sympy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_5to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED 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("to_sympy (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "to_sympy") < 0)) __PYX_ERR(0, 2290, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_sympy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2290, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.Rational.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_4to_sympy(__pyx_self, __pyx_v_self, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_4to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  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("to_sympy", 0);

  /* "mathics/core/expression.py":2291
 * 
 *     def to_sympy(self, **kwargs):
 *         return self.value             # <<<<<<<<<<<<<<
 * 
 *     def to_mpmath(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2290
 *         return self.format(evaluation, f.get_name())
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.Rational.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2293
 *         return self.value
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_7to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_7to_mpmath = {"to_mpmath", (PyCFunction)__pyx_pw_7mathics_4core_10expression_8Rational_7to_mpmath, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_7to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_mpmath (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_6to_mpmath(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2294
 * 
 *     def to_mpmath(self):
 *         return mpmath.mpf(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def to_python(self, *args, **kwargs) -> float:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mpf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2294, __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;

  /* "mathics/core/expression.py":2293
 *         return self.value
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */

  /* 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("mathics.core.expression.Rational.to_mpmath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2296
 *         return mpmath.mpf(self.value)
 * 
 *     def to_python(self, *args, **kwargs) -> float:             # <<<<<<<<<<<<<<
 *         return float(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_9to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_9to_python = {"to_python", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_9to_python, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_9to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED 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("to_python (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_self,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_self)) != 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, "to_python") < 0)) __PYX_ERR(0, 2296, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_python", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2296, __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("mathics.core.expression.Rational.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_8to_python(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_8to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  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("to_python", 0);

  /* "mathics/core/expression.py":2297
 * 
 *     def to_python(self, *args, **kwargs) -> float:
 *         return float(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyNumber_Float(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2297, __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;

  /* "mathics/core/expression.py":2296
 *         return mpmath.mpf(self.value)
 * 
 *     def to_python(self, *args, **kwargs) -> float:             # <<<<<<<<<<<<<<
 *         return float(self.value)
 * 
 */

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

/* "mathics/core/expression.py":2299
 *         return float(self.value)
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_11round(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_11round = {"round", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_11round, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_11round(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_d = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("round (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_d,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "round") < 0)) __PYX_ERR(0, 2299, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("round", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2299, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Rational.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_10round(__pyx_self, __pyx_v_self, __pyx_v_d);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_10round(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("round", 0);

  /* "mathics/core/expression.py":2300
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 *         if d is None:             # <<<<<<<<<<<<<<
 *             return MachineReal(float(self.value))
 *         else:
 */
  __pyx_t_1 = (__pyx_v_d == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":2301
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 *         if d is None:
 *             return MachineReal(float(self.value))             # <<<<<<<<<<<<<<
 *         else:
 *             return PrecisionReal(self.value.n(d))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyNumber_Float(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2301, __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, 2301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2300
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 *         if d is None:             # <<<<<<<<<<<<<<
 *             return MachineReal(float(self.value))
 *         else:
 */
  }

  /* "mathics/core/expression.py":2303
 *             return MachineReal(float(self.value))
 *         else:
 *             return PrecisionReal(self.value.n(d))             # <<<<<<<<<<<<<<
 * 
 *     def sameQ(self, other) -> bool:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_PrecisionReal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_v_d) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_d);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2299
 *         return float(self.value)
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.Rational.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2305
 *             return PrecisionReal(self.value.n(d))
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, Rational) and self.value == other.value
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_13sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_8Rational_12sameQ[] = "Mathics SameQ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_13sameQ = {"sameQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_13sameQ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_8Rational_12sameQ};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_13sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sameQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, 1); __PYX_ERR(0, 2305, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sameQ") < 0)) __PYX_ERR(0, 2305, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2305, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Rational.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_12sameQ(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":2307
 *     def sameQ(self, other) -> bool:
 *         """Mathics SameQ"""
 *         return isinstance(other, Rational) and self.value == other.value             # <<<<<<<<<<<<<<
 * 
 *     def numerator(self) -> "Integer":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Rational); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_other, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2307, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2307, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2305
 *             return PrecisionReal(self.value.n(d))
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, Rational) and self.value == other.value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Rational.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2309
 *         return isinstance(other, Rational) and self.value == other.value
 * 
 *     def numerator(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value.as_numer_denom()[0])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_15numerator(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_15numerator = {"numerator", (PyCFunction)__pyx_pw_7mathics_4core_10expression_8Rational_15numerator, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_15numerator(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numerator (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_14numerator(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_14numerator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  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("numerator", 0);

  /* "mathics/core/expression.py":2310
 * 
 *     def numerator(self) -> "Integer":
 *         return Integer(self.value.as_numer_denom()[0])             # <<<<<<<<<<<<<<
 * 
 *     def denominator(self) -> "Integer":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_as_numer_denom); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__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_3)) __PYX_ERR(0, 2310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2310, __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;

  /* "mathics/core/expression.py":2309
 *         return isinstance(other, Rational) and self.value == other.value
 * 
 *     def numerator(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value.as_numer_denom()[0])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Rational.numerator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2312
 *         return Integer(self.value.as_numer_denom()[0])
 * 
 *     def denominator(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value.as_numer_denom()[1])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_17denominator(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_17denominator = {"denominator", (PyCFunction)__pyx_pw_7mathics_4core_10expression_8Rational_17denominator, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_17denominator(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("denominator (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_16denominator(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_16denominator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  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("denominator", 0);

  /* "mathics/core/expression.py":2313
 * 
 *     def denominator(self) -> "Integer":
 *         return Integer(self.value.as_numer_denom()[1])             # <<<<<<<<<<<<<<
 * 
 *     def do_format(self, evaluation, form) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_as_numer_denom); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__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_3)) __PYX_ERR(0, 2313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && 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_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2313, __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;

  /* "mathics/core/expression.py":2312
 *         return Integer(self.value.as_numer_denom()[0])
 * 
 *     def denominator(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value.as_numer_denom()[1])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Rational.denominator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2315
 *         return Integer(self.value.as_numer_denom()[1])
 * 
 *     def do_format(self, evaluation, form) -> "Expression":             # <<<<<<<<<<<<<<
 *         assert fully_qualified_symbol_name(form)
 *         if form == "System`FullForm":
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_19do_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_19do_format = {"do_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_19do_format, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_19do_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, 1); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, 2); __PYX_ERR(0, 2315, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "do_format") < 0)) __PYX_ERR(0, 2315, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2315, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Rational.do_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_18do_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_18do_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form) {
  PyObject *__pyx_v_numerator = NULL;
  PyObject *__pyx_v_minus = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("do_format", 0);

  /* "mathics/core/expression.py":2316
 * 
 *     def do_format(self, evaluation, form) -> "Expression":
 *         assert fully_qualified_symbol_name(form)             # <<<<<<<<<<<<<<
 *         if form == "System`FullForm":
 *             return Expression(
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_fully_qualified_symbol_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_form) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_form);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2316, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 2316, __pyx_L1_error)
    }
  }
  #endif

  /* "mathics/core/expression.py":2317
 *     def do_format(self, evaluation, form) -> "Expression":
 *         assert fully_qualified_symbol_name(form)
 *         if form == "System`FullForm":             # <<<<<<<<<<<<<<
 *             return Expression(
 *                 Expression("HoldForm", Symbol("Rational")),
 */
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_form, __pyx_kp_u_System_FullForm, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2317, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2318
 *         assert fully_qualified_symbol_name(form)
 *         if form == "System`FullForm":
 *             return Expression(             # <<<<<<<<<<<<<<
 *                 Expression("HoldForm", Symbol("Rational")),
 *                 self.numerator(),
 */
    __Pyx_XDECREF(__pyx_r);

    /* "mathics/core/expression.py":2322
 *                 self.numerator(),
 *                 self.denominator(),
 *             ).do_format(evaluation, form)             # <<<<<<<<<<<<<<
 *         else:
 *             numerator = self.numerator()
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2318, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "mathics/core/expression.py":2319
 *         if form == "System`FullForm":
 *             return Expression(
 *                 Expression("HoldForm", Symbol("Rational")),             # <<<<<<<<<<<<<<
 *                 self.numerator(),
 *                 self.denominator(),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Expression); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_n_u_Rational) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_n_u_Rational);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_u_HoldForm, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2319, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_u_HoldForm, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2319, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_HoldForm);
      __Pyx_GIVEREF(__pyx_n_u_HoldForm);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_n_u_HoldForm);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2319, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "mathics/core/expression.py":2320
 *             return Expression(
 *                 Expression("HoldForm", Symbol("Rational")),
 *                 self.numerator(),             # <<<<<<<<<<<<<<
 *                 self.denominator(),
 *             ).do_format(evaluation, form)
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_numerator); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "mathics/core/expression.py":2321
 *                 Expression("HoldForm", Symbol("Rational")),
 *                 self.numerator(),
 *                 self.denominator(),             # <<<<<<<<<<<<<<
 *             ).do_format(evaluation, form)
 *         else:
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_denominator); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_9 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2321, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_5, __pyx_t_6, __pyx_t_9};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2318, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_5, __pyx_t_6, __pyx_t_9};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2318, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_10, __pyx_t_9);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_9 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/core/expression.py":2322
 *                 self.numerator(),
 *                 self.denominator(),
 *             ).do_format(evaluation, form)             # <<<<<<<<<<<<<<
 *         else:
 *             numerator = self.numerator()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_do_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    __pyx_t_10 = 0;
    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_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_evaluation, __pyx_v_form};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2322, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_evaluation, __pyx_v_form};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2322, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_v_evaluation);
      __Pyx_INCREF(__pyx_v_form);
      __Pyx_GIVEREF(__pyx_v_form);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_form);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2317
 *     def do_format(self, evaluation, form) -> "Expression":
 *         assert fully_qualified_symbol_name(form)
 *         if form == "System`FullForm":             # <<<<<<<<<<<<<<
 *             return Expression(
 *                 Expression("HoldForm", Symbol("Rational")),
 */
  }

  /* "mathics/core/expression.py":2324
 *             ).do_format(evaluation, form)
 *         else:
 *             numerator = self.numerator()             # <<<<<<<<<<<<<<
 *             minus = numerator.value < 0
 *             if minus:
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_numerator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_1 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_numerator = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":2325
 *         else:
 *             numerator = self.numerator()
 *             minus = numerator.value < 0             # <<<<<<<<<<<<<<
 *             if minus:
 *                 numerator = Integer(-numerator.value)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_numerator, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2325, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2325, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_minus = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":2326
 *             numerator = self.numerator()
 *             minus = numerator.value < 0
 *             if minus:             # <<<<<<<<<<<<<<
 *                 numerator = Integer(-numerator.value)
 *             result = Expression("Divide", numerator, self.denominator())
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_minus); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2326, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":2327
 *             minus = numerator.value < 0
 *             if minus:
 *                 numerator = Integer(-numerator.value)             # <<<<<<<<<<<<<<
 *             result = Expression("Divide", numerator, self.denominator())
 *             if minus:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Integer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_numerator, __pyx_n_s_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyNumber_Negative(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_numerator, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":2326
 *             numerator = self.numerator()
 *             minus = numerator.value < 0
 *             if minus:             # <<<<<<<<<<<<<<
 *                 numerator = Integer(-numerator.value)
 *             result = Expression("Divide", numerator, self.denominator())
 */
    }

    /* "mathics/core/expression.py":2328
 *             if minus:
 *                 numerator = Integer(-numerator.value)
 *             result = Expression("Divide", numerator, self.denominator())             # <<<<<<<<<<<<<<
 *             if minus:
 *                 result = Expression("Minus", result)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_denominator); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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_2 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_n_u_Divide, __pyx_v_numerator, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2328, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_n_u_Divide, __pyx_v_numerator, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2328, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_Divide);
      __Pyx_GIVEREF(__pyx_n_u_Divide);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_n_u_Divide);
      __Pyx_INCREF(__pyx_v_numerator);
      __Pyx_GIVEREF(__pyx_v_numerator);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_v_numerator);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_10, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2328, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_result = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":2329
 *                 numerator = Integer(-numerator.value)
 *             result = Expression("Divide", numerator, self.denominator())
 *             if minus:             # <<<<<<<<<<<<<<
 *                 result = Expression("Minus", result)
 *             result = Expression("HoldForm", result)
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_minus); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2329, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "mathics/core/expression.py":2330
 *             result = Expression("Divide", numerator, self.denominator())
 *             if minus:
 *                 result = Expression("Minus", result)             # <<<<<<<<<<<<<<
 *             result = Expression("HoldForm", result)
 *             return result.do_format(evaluation, form)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2330, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = NULL;
      __pyx_t_10 = 0;
      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_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_n_u_Minus, __pyx_v_result};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2330, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_n_u_Minus, __pyx_v_result};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2330, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2330, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_n_u_Minus);
        __Pyx_GIVEREF(__pyx_n_u_Minus);
        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_10, __pyx_n_u_Minus);
        __Pyx_INCREF(__pyx_v_result);
        __Pyx_GIVEREF(__pyx_v_result);
        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_10, __pyx_v_result);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2330, __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_SET(__pyx_v_result, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":2329
 *                 numerator = Integer(-numerator.value)
 *             result = Expression("Divide", numerator, self.denominator())
 *             if minus:             # <<<<<<<<<<<<<<
 *                 result = Expression("Minus", result)
 *             result = Expression("HoldForm", result)
 */
    }

    /* "mathics/core/expression.py":2331
 *             if minus:
 *                 result = Expression("Minus", result)
 *             result = Expression("HoldForm", result)             # <<<<<<<<<<<<<<
 *             return result.do_format(evaluation, form)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_u_HoldForm, __pyx_v_result};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2331, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_u_HoldForm, __pyx_v_result};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2331, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_HoldForm);
      __Pyx_GIVEREF(__pyx_n_u_HoldForm);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_n_u_HoldForm);
      __Pyx_INCREF(__pyx_v_result);
      __Pyx_GIVEREF(__pyx_v_result);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_v_result);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2331, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":2332
 *                 result = Expression("Minus", result)
 *             result = Expression("HoldForm", result)
 *             return result.do_format(evaluation, form)             # <<<<<<<<<<<<<<
 * 
 *     def default_format(self, evaluation, form) -> str:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_do_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(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_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_evaluation, __pyx_v_form};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2332, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_evaluation, __pyx_v_form};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2332, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2332, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_10, __pyx_v_evaluation);
      __Pyx_INCREF(__pyx_v_form);
      __Pyx_GIVEREF(__pyx_v_form);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_10, __pyx_v_form);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2332, __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;
  }

  /* "mathics/core/expression.py":2315
 *         return Integer(self.value.as_numer_denom()[1])
 * 
 *     def do_format(self, evaluation, form) -> "Expression":             # <<<<<<<<<<<<<<
 *         assert fully_qualified_symbol_name(form)
 *         if form == "System`FullForm":
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.core.expression.Rational.do_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_numerator);
  __Pyx_XDECREF(__pyx_v_minus);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2334
 *             return result.do_format(evaluation, form)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "Rational[%s, %s]" % self.value.as_numer_denom()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_21default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_21default_format = {"default_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_21default_format, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_21default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  CYTHON_UNUSED PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 1); __PYX_ERR(0, 2334, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 2); __PYX_ERR(0, 2334, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_format") < 0)) __PYX_ERR(0, 2334, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2334, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Rational.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_20default_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_20default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation, CYTHON_UNUSED PyObject *__pyx_v_form) {
  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("default_format", 0);

  /* "mathics/core/expression.py":2335
 * 
 *     def default_format(self, evaluation, form) -> str:
 *         return "Rational[%s, %s]" % self.value.as_numer_denom()             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, evaluation) -> "Rational":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_as_numer_denom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_Rational_s_s, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2334
 *             return result.do_format(evaluation, form)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "Rational[%s, %s]" % self.value.as_numer_denom()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Rational.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2337
 *         return "Rational[%s, %s]" % self.value.as_numer_denom()
 * 
 *     def evaluate(self, evaluation) -> "Rational":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_23evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_23evaluate = {"evaluate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_23evaluate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_23evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); __PYX_ERR(0, 2337, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) __PYX_ERR(0, 2337, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2337, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Rational.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_22evaluate(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_22evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  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("evaluate", 0);

  /* "mathics/core/expression.py":2338
 * 
 *     def evaluate(self, evaluation) -> "Rational":
 *         evaluation.check_stopped()             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_check_stopped); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2338, __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, 2338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2339
 *     def evaluate(self, evaluation) -> "Rational":
 *         evaluation.check_stopped()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def get_sort_key(self, pattern_sort=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2337
 *         return "Rational[%s, %s]" % self.value.as_numer_denom()
 * 
 *     def evaluate(self, evaluation) -> "Rational":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Rational.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2341
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_25get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_25get_sort_key = {"get_sort_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_25get_sort_key, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_25get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_pattern_sort = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sort_key (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_pattern_sort,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_sort);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_sort_key") < 0)) __PYX_ERR(0, 2341, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_pattern_sort = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_sort_key", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2341, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Rational.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_24get_sort_key(__pyx_self, __pyx_v_self, __pyx_v_pattern_sort);

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

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

  /* "mathics/core/expression.py":2342
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_sort); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2342, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2343
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:
 *             return super().get_sort_key(True)             # <<<<<<<<<<<<<<
 *         else:
 *             # HACK: otherwise "Bus error" when comparing 1==1.
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_CyFunction_GetClassObj(__pyx_self);
    if (!__pyx_t_3) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 2343, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2342
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         else:
 */
  }

  /* "mathics/core/expression.py":2346
 *         else:
 *             # HACK: otherwise "Bus error" when comparing 1==1.
 *             return [0, 0, sympy.Float(self.value), 0, 1]             # <<<<<<<<<<<<<<
 * 
 *     def do_copy(self) -> "Rational":
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sympy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Float); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyList_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_3, 3, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_3, 4, __pyx_int_1);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2341
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

  /* 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("mathics.core.expression.Rational.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2348
 *             return [0, 0, sympy.Float(self.value), 0, 1]
 * 
 *     def do_copy(self) -> "Rational":             # <<<<<<<<<<<<<<
 *         return Rational(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_27do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_27do_copy = {"do_copy", (PyCFunction)__pyx_pw_7mathics_4core_10expression_8Rational_27do_copy, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_27do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_26do_copy(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2349
 * 
 *     def do_copy(self) -> "Rational":
 *         return Rational(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Rational); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2349, __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;

  /* "mathics/core/expression.py":2348
 *             return [0, 0, sympy.Float(self.value), 0, 1]
 * 
 *     def do_copy(self) -> "Rational":             # <<<<<<<<<<<<<<
 *         return Rational(self.value)
 * 
 */

  /* 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("mathics.core.expression.Rational.do_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2351
 *         return Rational(self.value)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Rational", self.value))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_29__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_29__hash__ = {"__hash__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_8Rational_29__hash__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_29__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_28__hash__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2352
 * 
 *     def __hash__(self):
 *         return hash(("Rational", self.value))             # <<<<<<<<<<<<<<
 * 
 *     def user_hash(self, update) -> None:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_Rational);
  __Pyx_GIVEREF(__pyx_n_u_Rational);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_Rational);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_Hash(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_hash_t)-1))) __PYX_ERR(0, 2352, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_FromHash_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2351
 *         return Rational(self.value)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Rational", self.value))
 * 
 */

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

/* "mathics/core/expression.py":2354
 *         return hash(("Rational", self.value))
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(
 *             b"System`Rational>" + ("%s>%s" % self.value.as_numer_denom()).encode("utf8")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_31user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_31user_hash = {"user_hash", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_8Rational_31user_hash, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_31user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_update = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("user_hash (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_update,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_update)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, 1); __PYX_ERR(0, 2354, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "user_hash") < 0)) __PYX_ERR(0, 2354, __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_update = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2354, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Rational.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_30user_hash(__pyx_self, __pyx_v_self, __pyx_v_update);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_30user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update) {
  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("user_hash", 0);

  /* "mathics/core/expression.py":2356
 *     def user_hash(self, update) -> None:
 *         update(
 *             b"System`Rational>" + ("%s>%s" % self.value.as_numer_denom()).encode("utf8")             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_as_numer_denom); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s_s, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_kp_b_System_Rational, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_v_update);
  __pyx_t_2 = __pyx_v_update; __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, 2355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2354
 *         return hash(("Rational", self.value))
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(
 *             b"System`Rational>" + ("%s>%s" % self.value.as_numer_denom()).encode("utf8")
 */

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

/* "mathics/core/expression.py":2359
 *         )
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.numerator().get_int_value(), self.denominator().get_int_value())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_33__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_33__getnewargs__ = {"__getnewargs__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_8Rational_33__getnewargs__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_33__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getnewargs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_32__getnewargs__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_8Rational_32__getnewargs__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  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("__getnewargs__", 0);

  /* "mathics/core/expression.py":2360
 * 
 *     def __getnewargs__(self):
 *         return (self.numerator().get_int_value(), self.denominator().get_int_value())             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self) -> "Rational":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_numerator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_denominator); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2360, __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_2 = (__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_2)) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2359
 *         )
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.numerator().get_int_value(), self.denominator().get_int_value())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Rational.__getnewargs__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2362
 *         return (self.numerator().get_int_value(), self.denominator().get_int_value())
 * 
 *     def __neg__(self) -> "Rational":             # <<<<<<<<<<<<<<
 *         return Rational(
 *             -self.numerator().get_int_value(), self.denominator().get_int_value()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_35__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_35__neg__ = {"__neg__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_8Rational_35__neg__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_35__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_34__neg__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2363
 * 
 *     def __neg__(self) -> "Rational":
 *         return Rational(             # <<<<<<<<<<<<<<
 *             -self.numerator().get_int_value(), self.denominator().get_int_value()
 *         )
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Rational); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "mathics/core/expression.py":2364
 *     def __neg__(self) -> "Rational":
 *         return Rational(
 *             -self.numerator().get_int_value(), self.denominator().get_int_value()             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_numerator); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__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_3)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_denominator); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2363, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2363, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_3);
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2362
 *         return (self.numerator().get_int_value(), self.denominator().get_int_value())
 * 
 *     def __neg__(self) -> "Rational":             # <<<<<<<<<<<<<<
 *         return Rational(
 *             -self.numerator().get_int_value(), self.denominator().get_int_value()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.Rational.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2368
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             self.numerator().is_zero
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_37is_zero(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_8Rational_37is_zero = {"is_zero", (PyCFunction)__pyx_pw_7mathics_4core_10expression_8Rational_37is_zero, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_8Rational_37is_zero(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_zero (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_8Rational_36is_zero(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2369
 *     @property
 *     def is_zero(self) -> bool:
 *         return (             # <<<<<<<<<<<<<<
 *             self.numerator().is_zero
 *         )  # (implicit) and not (self.denominator().is_zero)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "mathics/core/expression.py":2370
 *     def is_zero(self) -> bool:
 *         return (
 *             self.numerator().is_zero             # <<<<<<<<<<<<<<
 *         )  # (implicit) and not (self.denominator().is_zero)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_numerator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2370, __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, 2370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_is_zero); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2370, __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;

  /* "mathics/core/expression.py":2368
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             self.numerator().is_zero
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Rational.is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2378
 * 
 * class Real(Number):
 *     def __new__(cls, value, p=None) -> "Real":             # <<<<<<<<<<<<<<
 *         if isinstance(value, str):
 *             value = str(value)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Real_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_p = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_value,&__pyx_n_s_p,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 3, 1); __PYX_ERR(0, 2378, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 2378, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_cls = values[0];
    __pyx_v_value = values[1];
    __pyx_v_p = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2378, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Real.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real___new__(__pyx_self, __pyx_v_cls, __pyx_v_value, __pyx_v_p);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Real___new__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_cls, PyObject *__pyx_v_value, PyObject *__pyx_v_p) {
  PyObject *__pyx_v_digits = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  Py_UCS4 __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_INCREF(__pyx_v_p);

  /* "mathics/core/expression.py":2379
 * class Real(Number):
 *     def __new__(cls, value, p=None) -> "Real":
 *         if isinstance(value, str):             # <<<<<<<<<<<<<<
 *             value = str(value)
 *             if p is None:
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_value); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":2380
 *     def __new__(cls, value, p=None) -> "Real":
 *         if isinstance(value, str):
 *             value = str(value)             # <<<<<<<<<<<<<<
 *             if p is None:
 *                 digits = ("".join(re.findall("[0-9]+", value))).lstrip("0")
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":2381
 *         if isinstance(value, str):
 *             value = str(value)
 *             if p is None:             # <<<<<<<<<<<<<<
 *                 digits = ("".join(re.findall("[0-9]+", value))).lstrip("0")
 *                 if digits == "":  # Handle weird Mathematica zero case
 */
    __pyx_t_2 = (__pyx_v_p == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":2382
 *             value = str(value)
 *             if p is None:
 *                 digits = ("".join(re.findall("[0-9]+", value))).lstrip("0")             # <<<<<<<<<<<<<<
 *                 if digits == "":  # Handle weird Mathematica zero case
 *                     p = max(prec(len(value.replace("0.", ""))), machine_precision)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_re); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_findall); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_0_9, __pyx_v_value};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2382, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_u_0_9, __pyx_v_value};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2382, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2382, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_INCREF(__pyx_kp_u_0_9);
        __Pyx_GIVEREF(__pyx_kp_u_0_9);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_0_9);
        __Pyx_INCREF(__pyx_v_value);
        __Pyx_GIVEREF(__pyx_v_value);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2382, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyUnicode_Join(__pyx_kp_u__3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_lstrip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_kp_u_0) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_0);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_digits = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":2383
 *             if p is None:
 *                 digits = ("".join(re.findall("[0-9]+", value))).lstrip("0")
 *                 if digits == "":  # Handle weird Mathematica zero case             # <<<<<<<<<<<<<<
 *                     p = max(prec(len(value.replace("0.", ""))), machine_precision)
 *                 else:
 */
      __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_digits, __pyx_kp_u__3, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2383, __pyx_L1_error)
      if (__pyx_t_1) {

        /* "mathics/core/expression.py":2384
 *                 digits = ("".join(re.findall("[0-9]+", value))).lstrip("0")
 *                 if digits == "":  # Handle weird Mathematica zero case
 *                     p = max(prec(len(value.replace("0.", ""))), machine_precision)             # <<<<<<<<<<<<<<
 *                 else:
 *                     p = prec(len(digits.zfill(dps(machine_precision))))
 */
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_machine_precision); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2384, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_prec); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2384, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_replace); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2384, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__74, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2384, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2384, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2384, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2384, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2384, __pyx_L1_error)
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2384, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (__pyx_t_1) {
          __Pyx_INCREF(__pyx_t_3);
          __pyx_t_6 = __pyx_t_3;
        } else {
          __Pyx_INCREF(__pyx_t_4);
          __pyx_t_6 = __pyx_t_4;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __pyx_t_6;
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "mathics/core/expression.py":2383
 *             if p is None:
 *                 digits = ("".join(re.findall("[0-9]+", value))).lstrip("0")
 *                 if digits == "":  # Handle weird Mathematica zero case             # <<<<<<<<<<<<<<
 *                     p = max(prec(len(value.replace("0.", ""))), machine_precision)
 *                 else:
 */
        goto __pyx_L5;
      }

      /* "mathics/core/expression.py":2386
 *                     p = max(prec(len(value.replace("0.", ""))), machine_precision)
 *                 else:
 *                     p = prec(len(digits.zfill(dps(machine_precision))))             # <<<<<<<<<<<<<<
 *         elif isinstance(value, sympy.Float):
 *             if p is None:
 */
      /*else*/ {
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_prec); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_digits, __pyx_n_s_zfill); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_dps); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_machine_precision); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        __pyx_t_8 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __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_4)) __PYX_ERR(0, 2386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_9 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2386, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __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(0, 2386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_3);
        __pyx_t_3 = 0;
      }
      __pyx_L5:;

      /* "mathics/core/expression.py":2381
 *         if isinstance(value, str):
 *             value = str(value)
 *             if p is None:             # <<<<<<<<<<<<<<
 *                 digits = ("".join(re.findall("[0-9]+", value))).lstrip("0")
 *                 if digits == "":  # Handle weird Mathematica zero case
 */
    }

    /* "mathics/core/expression.py":2379
 * class Real(Number):
 *     def __new__(cls, value, p=None) -> "Real":
 *         if isinstance(value, str):             # <<<<<<<<<<<<<<
 *             value = str(value)
 *             if p is None:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":2387
 *                 else:
 *                     p = prec(len(digits.zfill(dps(machine_precision))))
 *         elif isinstance(value, sympy.Float):             # <<<<<<<<<<<<<<
 *             if p is None:
 *                 p = value._prec + 1
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sympy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Float); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_value, __pyx_t_6); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2387, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":2388
 *                     p = prec(len(digits.zfill(dps(machine_precision))))
 *         elif isinstance(value, sympy.Float):
 *             if p is None:             # <<<<<<<<<<<<<<
 *                 p = value._prec + 1
 *         elif isinstance(value, (Integer, sympy.Number, mpmath.mpf, float, int)):
 */
    __pyx_t_2 = (__pyx_v_p == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":2389
 *         elif isinstance(value, sympy.Float):
 *             if p is None:
 *                 p = value._prec + 1             # <<<<<<<<<<<<<<
 *         elif isinstance(value, (Integer, sympy.Number, mpmath.mpf, float, int)):
 *             if p is not None and p > machine_precision:
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_prec_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2389, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2389, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":2388
 *                     p = prec(len(digits.zfill(dps(machine_precision))))
 *         elif isinstance(value, sympy.Float):
 *             if p is None:             # <<<<<<<<<<<<<<
 *                 p = value._prec + 1
 *         elif isinstance(value, (Integer, sympy.Number, mpmath.mpf, float, int)):
 */
    }

    /* "mathics/core/expression.py":2387
 *                 else:
 *                     p = prec(len(digits.zfill(dps(machine_precision))))
 *         elif isinstance(value, sympy.Float):             # <<<<<<<<<<<<<<
 *             if p is None:
 *                 p = value._prec + 1
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":2390
 *             if p is None:
 *                 p = value._prec + 1
 *         elif isinstance(value, (Integer, sympy.Number, mpmath.mpf, float, int)):             # <<<<<<<<<<<<<<
 *             if p is not None and p > machine_precision:
 *                 value = str(value)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Integer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_sympy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Number); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_mpf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_3); 
  __pyx_t_13 = (__pyx_t_2 != 0);
  if (!__pyx_t_13) {
  } else {
    __pyx_t_1 = __pyx_t_13;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_13 = PyObject_IsInstance(__pyx_v_value, __pyx_t_4); 
  __pyx_t_2 = (__pyx_t_13 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_value, __pyx_t_5); 
  __pyx_t_13 = (__pyx_t_2 != 0);
  if (!__pyx_t_13) {
  } else {
    __pyx_t_1 = __pyx_t_13;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_13 = PyFloat_Check(__pyx_v_value); 
  __pyx_t_2 = (__pyx_t_13 != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_2 = PyInt_Check(__pyx_v_value); 
  __pyx_t_13 = (__pyx_t_2 != 0);
  __pyx_t_1 = __pyx_t_13;
  __pyx_L7_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_13 = (__pyx_t_1 != 0);
  if (likely(__pyx_t_13)) {

    /* "mathics/core/expression.py":2391
 *                 p = value._prec + 1
 *         elif isinstance(value, (Integer, sympy.Number, mpmath.mpf, float, int)):
 *             if p is not None and p > machine_precision:             # <<<<<<<<<<<<<<
 *                 value = str(value)
 *         else:
 */
    __pyx_t_1 = (__pyx_v_p != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_13 = __pyx_t_2;
      goto __pyx_L13_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_machine_precision); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_p, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2391, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2391, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_13 = __pyx_t_2;
    __pyx_L13_bool_binop_done:;
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2392
 *         elif isinstance(value, (Integer, sympy.Number, mpmath.mpf, float, int)):
 *             if p is not None and p > machine_precision:
 *                 value = str(value)             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError("Unknown number type: %s (type %s)" % (value, type(value)))
 */
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "mathics/core/expression.py":2391
 *                 p = value._prec + 1
 *         elif isinstance(value, (Integer, sympy.Number, mpmath.mpf, float, int)):
 *             if p is not None and p > machine_precision:             # <<<<<<<<<<<<<<
 *                 value = str(value)
 *         else:
 */
    }

    /* "mathics/core/expression.py":2390
 *             if p is None:
 *                 p = value._prec + 1
 *         elif isinstance(value, (Integer, sympy.Number, mpmath.mpf, float, int)):             # <<<<<<<<<<<<<<
 *             if p is not None and p > machine_precision:
 *                 value = str(value)
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":2394
 *                 value = str(value)
 *         else:
 *             raise TypeError("Unknown number type: %s (type %s)" % (value, type(value)))             # <<<<<<<<<<<<<<
 * 
 *         # return either machine precision or arbitrary precision real
 */
  /*else*/ {
    __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = 0;
    __pyx_t_14 = 127;
    __Pyx_INCREF(__pyx_kp_u_Unknown_number_type);
    __pyx_t_9 += 21;
    __Pyx_GIVEREF(__pyx_kp_u_Unknown_number_type);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Unknown_number_type);
    __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_v_value), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_14;
    __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_kp_u_type);
    __pyx_t_9 += 7;
    __Pyx_GIVEREF(__pyx_kp_u_type);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_type);
    __pyx_t_3 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(((PyObject *)Py_TYPE(__pyx_v_value))), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_14) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_14;
    __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_kp_u__75);
    __pyx_t_9 += 1;
    __Pyx_GIVEREF(__pyx_kp_u__75);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_kp_u__75);
    __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 5, __pyx_t_9, __pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2394, __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, 2394, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":2397
 * 
 *         # return either machine precision or arbitrary precision real
 *         if p is None or p == machine_precision:             # <<<<<<<<<<<<<<
 *             return MachineReal.__new__(MachineReal, value)
 *         else:
 */
  __pyx_t_2 = (__pyx_v_p == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (!__pyx_t_1) {
  } else {
    __pyx_t_13 = __pyx_t_1;
    goto __pyx_L16_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_machine_precision); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_p, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2397, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2397, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_13 = __pyx_t_1;
  __pyx_L16_bool_binop_done:;
  if (__pyx_t_13) {

    /* "mathics/core/expression.py":2398
 *         # return either machine precision or arbitrary precision real
 *         if p is None or p == machine_precision:
 *             return MachineReal.__new__(MachineReal, value)             # <<<<<<<<<<<<<<
 *         else:
 *             return PrecisionReal.__new__(PrecisionReal, value)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_new_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2398, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2398, __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_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_4, __pyx_v_value};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2398, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __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_4, __pyx_v_value};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2398, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __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, 2398, __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_4);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
      __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2397
 * 
 *         # return either machine precision or arbitrary precision real
 *         if p is None or p == machine_precision:             # <<<<<<<<<<<<<<
 *             return MachineReal.__new__(MachineReal, value)
 *         else:
 */
  }

  /* "mathics/core/expression.py":2400
 *             return MachineReal.__new__(MachineReal, value)
 *         else:
 *             return PrecisionReal.__new__(PrecisionReal, value)             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_text(self, **options) -> str:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PrecisionReal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_new_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PrecisionReal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_v_value};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2400, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_v_value};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2400, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_5);
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_value);
      __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2378
 * 
 * class Real(Number):
 *     def __new__(cls, value, p=None) -> "Real":             # <<<<<<<<<<<<<<
 *         if isinstance(value, str):
 *             value = str(value)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("mathics.core.expression.Real.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_digits);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2402
 *             return PrecisionReal.__new__(PrecisionReal, value)
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`OutputForm").boxes_to_text(**options)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_3boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_3boxes_to_text = {"boxes_to_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Real_3boxes_to_text, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_3boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_text (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_text") < 0)) __PYX_ERR(0, 2402, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_text", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2402, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.Real.boxes_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_2boxes_to_text(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_2boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options) {
  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("boxes_to_text", 0);

  /* "mathics/core/expression.py":2403
 * 
 *     def boxes_to_text(self, **options) -> str:
 *         return self.make_boxes("System`OutputForm").boxes_to_text(**options)             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_mathml(self, **options) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_boxes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_System_OutputForm) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_System_OutputForm);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_boxes_to_text); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_v_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2403, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2402
 *             return PrecisionReal.__new__(PrecisionReal, value)
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`OutputForm").boxes_to_text(**options)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Real.boxes_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2405
 *         return self.make_boxes("System`OutputForm").boxes_to_text(**options)
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`MathMLForm").boxes_to_mathml(**options)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_5boxes_to_mathml(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_5boxes_to_mathml = {"boxes_to_mathml", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Real_5boxes_to_mathml, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_5boxes_to_mathml(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_mathml (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_mathml") < 0)) __PYX_ERR(0, 2405, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_mathml", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2405, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.Real.boxes_to_mathml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_4boxes_to_mathml(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_4boxes_to_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options) {
  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("boxes_to_mathml", 0);

  /* "mathics/core/expression.py":2406
 * 
 *     def boxes_to_mathml(self, **options) -> str:
 *         return self.make_boxes("System`MathMLForm").boxes_to_mathml(**options)             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_tex(self, **options) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_boxes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_System_MathMLForm) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_System_MathMLForm);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_boxes_to_mathml); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_v_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2406, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2405
 *         return self.make_boxes("System`OutputForm").boxes_to_text(**options)
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`MathMLForm").boxes_to_mathml(**options)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Real.boxes_to_mathml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2408
 *         return self.make_boxes("System`MathMLForm").boxes_to_mathml(**options)
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`TeXForm").boxes_to_tex(**options)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_7boxes_to_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_7boxes_to_tex = {"boxes_to_tex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Real_7boxes_to_tex, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_7boxes_to_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_tex (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_tex") < 0)) __PYX_ERR(0, 2408, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_tex", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2408, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.Real.boxes_to_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_6boxes_to_tex(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_6boxes_to_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_options) {
  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("boxes_to_tex", 0);

  /* "mathics/core/expression.py":2409
 * 
 *     def boxes_to_tex(self, **options) -> str:
 *         return self.make_boxes("System`TeXForm").boxes_to_tex(**options)             # <<<<<<<<<<<<<<
 * 
 *     def atom_to_boxes(self, f, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_boxes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_System_TeXForm) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_System_TeXForm);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_boxes_to_tex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_v_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2409, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2408
 *         return self.make_boxes("System`MathMLForm").boxes_to_mathml(**options)
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`TeXForm").boxes_to_tex(**options)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Real.boxes_to_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2411
 *         return self.make_boxes("System`TeXForm").boxes_to_tex(**options)
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.make_boxes(f.get_name())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_9atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_9atom_to_boxes = {"atom_to_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Real_9atom_to_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_9atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_f = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atom_to_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_f,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 1); __PYX_ERR(0, 2411, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 2); __PYX_ERR(0, 2411, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atom_to_boxes") < 0)) __PYX_ERR(0, 2411, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_f = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2411, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Real.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_8atom_to_boxes(__pyx_self, __pyx_v_self, __pyx_v_f, __pyx_v_evaluation);

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

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

  /* "mathics/core/expression.py":2412
 * 
 *     def atom_to_boxes(self, f, evaluation):
 *         return self.make_boxes(f.get_name())             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, evaluation) -> "Real":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_make_boxes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_get_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2412, __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, 2412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2412, __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;

  /* "mathics/core/expression.py":2411
 *         return self.make_boxes("System`TeXForm").boxes_to_tex(**options)
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.make_boxes(f.get_name())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Real.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2414
 *         return self.make_boxes(f.get_name())
 * 
 *     def evaluate(self, evaluation) -> "Real":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_11evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_11evaluate = {"evaluate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Real_11evaluate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_11evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); __PYX_ERR(0, 2414, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) __PYX_ERR(0, 2414, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2414, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Real.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_10evaluate(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_10evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  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("evaluate", 0);

  /* "mathics/core/expression.py":2415
 * 
 *     def evaluate(self, evaluation) -> "Real":
 *         evaluation.check_stopped()             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_check_stopped); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2415, __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, 2415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2416
 *     def evaluate(self, evaluation) -> "Real":
 *         evaluation.check_stopped()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def get_sort_key(self, pattern_sort=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2414
 *         return self.make_boxes(f.get_name())
 * 
 *     def evaluate(self, evaluation) -> "Real":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Real.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2418
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_13get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_13get_sort_key = {"get_sort_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Real_13get_sort_key, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_13get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_pattern_sort = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sort_key (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_pattern_sort,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_sort);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_sort_key") < 0)) __PYX_ERR(0, 2418, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_pattern_sort = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_sort_key", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2418, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Real.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_12get_sort_key(__pyx_self, __pyx_v_self, __pyx_v_pattern_sort);

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

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

  /* "mathics/core/expression.py":2419
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         return [0, 0, self.value, 0, 1]
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_sort); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2419, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2420
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:
 *             return super().get_sort_key(True)             # <<<<<<<<<<<<<<
 *         return [0, 0, self.value, 0, 1]
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_CyFunction_GetClassObj(__pyx_self);
    if (!__pyx_t_3) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 2420, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2419
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         return [0, 0, self.value, 0, 1]
 */
  }

  /* "mathics/core/expression.py":2421
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 *         return [0, 0, self.value, 0, 1]             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyList_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_4, 3, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_4, 4, __pyx_int_1);
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2418
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.Real.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2423
 *         return [0, 0, self.value, 0, 1]
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         if isinstance(other, Real):
 *             # MMA Docs: "Approximate numbers that differ in their last seven
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_15__eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_15__eq__ = {"__eq__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Real_15__eq__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_15__eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, 1); __PYX_ERR(0, 2423, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__eq__") < 0)) __PYX_ERR(0, 2423, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2423, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Real.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_14__eq__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_14__eq__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_v__prec = NULL;
  PyObject *__pyx_v_rel_eps = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__eq__", 0);

  /* "mathics/core/expression.py":2424
 * 
 *     def __eq__(self, other) -> bool:
 *         if isinstance(other, Real):             # <<<<<<<<<<<<<<
 *             # MMA Docs: "Approximate numbers that differ in their last seven
 *             # binary digits are considered equal"
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_other, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2424, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":2427
 *             # MMA Docs: "Approximate numbers that differ in their last seven
 *             # binary digits are considered equal"
 *             _prec = min_prec(self, other)             # <<<<<<<<<<<<<<
 *             with mpmath.workprec(_prec):
 *                 rel_eps = 0.5 ** (_prec - 7)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_min_prec); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 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_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_self, __pyx_v_other};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2427, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_self, __pyx_v_other};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2427, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_self);
      __Pyx_INCREF(__pyx_v_other);
      __Pyx_GIVEREF(__pyx_v_other);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_other);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2427, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v__prec = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":2428
 *             # binary digits are considered equal"
 *             _prec = min_prec(self, other)
 *             with mpmath.workprec(_prec):             # <<<<<<<<<<<<<<
 *                 rel_eps = 0.5 ** (_prec - 7)
 *                 return mpmath.almosteq(
 */
    /*with:*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2428, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_workprec); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2428, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_4, __pyx_v__prec) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v__prec);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2428, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2428, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2428, __pyx_L4_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_7 = (__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_7)) __PYX_ERR(0, 2428, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      /*try:*/ {
        {
          __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:*/ {

            /* "mathics/core/expression.py":2429
 *             _prec = min_prec(self, other)
 *             with mpmath.workprec(_prec):
 *                 rel_eps = 0.5 ** (_prec - 7)             # <<<<<<<<<<<<<<
 *                 return mpmath.almosteq(
 *                     self.to_mpmath(), other.to_mpmath(), abs_eps=0, rel_eps=rel_eps
 */
            __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v__prec, __pyx_int_7, 7, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2429, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_7 = PyNumber_Power(__pyx_float_0_5, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2429, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_v_rel_eps = __pyx_t_7;
            __pyx_t_7 = 0;

            /* "mathics/core/expression.py":2430
 *             with mpmath.workprec(_prec):
 *                 rel_eps = 0.5 ** (_prec - 7)
 *                 return mpmath.almosteq(             # <<<<<<<<<<<<<<
 *                     self.to_mpmath(), other.to_mpmath(), abs_eps=0, rel_eps=rel_eps
 *                 )
 */
            __Pyx_XDECREF(__pyx_r);
            __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2430, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_almosteq); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2430, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "mathics/core/expression.py":2431
 *                 rel_eps = 0.5 ** (_prec - 7)
 *                 return mpmath.almosteq(
 *                     self.to_mpmath(), other.to_mpmath(), abs_eps=0, rel_eps=rel_eps             # <<<<<<<<<<<<<<
 *                 )
 *         else:
 */
            __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to_mpmath); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2431, __pyx_L8_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_7 = (__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_7)) __PYX_ERR(0, 2431, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_to_mpmath); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2431, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_12 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
              __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
              if (likely(__pyx_t_12)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
                __Pyx_INCREF(__pyx_t_12);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_5, function);
              }
            }
            __pyx_t_4 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2431, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

            /* "mathics/core/expression.py":2430
 *             with mpmath.workprec(_prec):
 *                 rel_eps = 0.5 ** (_prec - 7)
 *                 return mpmath.almosteq(             # <<<<<<<<<<<<<<
 *                     self.to_mpmath(), other.to_mpmath(), abs_eps=0, rel_eps=rel_eps
 *                 )
 */
            __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2430, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
            __pyx_t_7 = 0;
            __pyx_t_4 = 0;

            /* "mathics/core/expression.py":2431
 *                 rel_eps = 0.5 ** (_prec - 7)
 *                 return mpmath.almosteq(
 *                     self.to_mpmath(), other.to_mpmath(), abs_eps=0, rel_eps=rel_eps             # <<<<<<<<<<<<<<
 *                 )
 *         else:
 */
            __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2431, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_4);
            if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_abs_eps, __pyx_int_0) < 0) __PYX_ERR(0, 2431, __pyx_L8_error)
            if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_rel_eps, __pyx_v_rel_eps) < 0) __PYX_ERR(0, 2431, __pyx_L8_error)

            /* "mathics/core/expression.py":2430
 *             with mpmath.workprec(_prec):
 *                 rel_eps = 0.5 ** (_prec - 7)
 *                 return mpmath.almosteq(             # <<<<<<<<<<<<<<
 *                     self.to_mpmath(), other.to_mpmath(), abs_eps=0, rel_eps=rel_eps
 *                 )
 */
            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2430, __pyx_L8_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_r = __pyx_t_7;
            __pyx_t_7 = 0;
            goto __pyx_L12_try_return;

            /* "mathics/core/expression.py":2428
 *             # binary digits are considered equal"
 *             _prec = min_prec(self, other)
 *             with mpmath.workprec(_prec):             # <<<<<<<<<<<<<<
 *                 rel_eps = 0.5 ** (_prec - 7)
 *                 return mpmath.almosteq(
 */
          }
          __pyx_L8_error:;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          /*except:*/ {
            __Pyx_AddTraceback("mathics.core.expression.Real.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(0, 2428, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_1 = PyTuple_Pack(3, __pyx_t_7, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2428, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, NULL);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2428, __pyx_L10_except_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            if (__pyx_t_3 < 0) __PYX_ERR(0, 2428, __pyx_L10_except_error)
            __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
            if (__pyx_t_2) {
              __Pyx_GIVEREF(__pyx_t_7);
              __Pyx_GIVEREF(__pyx_t_4);
              __Pyx_XGIVEREF(__pyx_t_5);
              __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_4, __pyx_t_5);
              __pyx_t_7 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; 
              __PYX_ERR(0, 2428, __pyx_L10_except_error)
            }
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            goto __pyx_L9_exception_handled;
          }
          __pyx_L10_except_error:;
          __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_L12_try_return:;
          __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_L5_return;
          __pyx_L9_exception_handled:;
          __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);
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_8) {
            __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__76, NULL);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2428, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          }
          goto __pyx_L7;
        }
        __pyx_L5_return: {
          __pyx_t_11 = __pyx_r;
          __pyx_r = 0;
          if (__pyx_t_8) {
            __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__76, NULL);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2428, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          __pyx_r = __pyx_t_11;
          __pyx_t_11 = 0;
          goto __pyx_L0;
        }
        __pyx_L7:;
      }
      goto __pyx_L17;
      __pyx_L4_error:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L1_error;
      __pyx_L17:;
    }

    /* "mathics/core/expression.py":2424
 * 
 *     def __eq__(self, other) -> bool:
 *         if isinstance(other, Real):             # <<<<<<<<<<<<<<
 *             # MMA Docs: "Approximate numbers that differ in their last seven
 *             # binary digits are considered equal"
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":2434
 *                 )
 *         else:
 *             return self.get_sort_key() == other.get_sort_key()             # <<<<<<<<<<<<<<
 * 
 *     def __ne__(self, other) -> bool:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2434, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":2423
 *         return [0, 0, self.value, 0, 1]
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         if isinstance(other, Real):
 *             # MMA Docs: "Approximate numbers that differ in their last seven
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("mathics.core.expression.Real.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__prec);
  __Pyx_XDECREF(__pyx_v_rel_eps);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2436
 *             return self.get_sort_key() == other.get_sort_key()
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         # Real is a total order
 *         return not (self == other)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_17__ne__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_17__ne__ = {"__ne__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Real_17__ne__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_17__ne__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__ne__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__ne__", 1, 2, 2, 1); __PYX_ERR(0, 2436, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__ne__") < 0)) __PYX_ERR(0, 2436, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__ne__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2436, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Real.__ne__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_16__ne__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_16__ne__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__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);

  /* "mathics/core/expression.py":2438
 *     def __ne__(self, other) -> bool:
 *         # Real is a total order
 *         return not (self == other)             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_self, __pyx_v_other, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2438, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2438, __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, 2438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2436
 *             return self.get_sort_key() == other.get_sort_key()
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         # Real is a total order
 *         return not (self == other)
 */

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

/* "mathics/core/expression.py":2440
 *         return not (self == other)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_19__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_19__hash__ = {"__hash__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_4Real_19__hash__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_19__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_18__hash__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_18__hash__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v__prec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_hash_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "mathics/core/expression.py":2442
 *     def __hash__(self):
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()             # <<<<<<<<<<<<<<
 *         return hash(("Real", self.to_sympy().n(dps(_prec))))
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2442, __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, 2442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v__prec = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2443
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()
 *         return hash(("Real", self.to_sympy().n(dps(_prec))))             # <<<<<<<<<<<<<<
 * 
 *     def user_hash(self, update):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_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, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_dps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v__prec) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v__prec);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2443, __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, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_u_Real);
  __Pyx_GIVEREF(__pyx_n_u_Real);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_Real);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_6 = PyObject_Hash(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_hash_t)-1))) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_FromHash_t(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2440
 *         return not (self == other)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Real.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__prec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2445
 *         return hash(("Real", self.to_sympy().n(dps(_prec))))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_21user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_21user_hash = {"user_hash", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_4Real_21user_hash, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_21user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_update = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("user_hash (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_update,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_update)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, 1); __PYX_ERR(0, 2445, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "user_hash") < 0)) __PYX_ERR(0, 2445, __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_update = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2445, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Real.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_20user_hash(__pyx_self, __pyx_v_self, __pyx_v_update);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_20user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update) {
  PyObject *__pyx_v__prec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("user_hash", 0);

  /* "mathics/core/expression.py":2447
 *     def user_hash(self, update):
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()             # <<<<<<<<<<<<<<
 *         update(b"System`Real>" + str(self.to_sympy().n(dps(_prec))).encode("utf8"))
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2447, __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, 2447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v__prec = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2448
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()
 *         update(b"System`Real>" + str(self.to_sympy().n(dps(_prec))).encode("utf8"))             # <<<<<<<<<<<<<<
 * 
 *     def get_atom_name(self) -> str:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2448, __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, 2448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_dps); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v__prec) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v__prec);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, 2448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_kp_b_System_Real, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_INCREF(__pyx_v_update);
  __pyx_t_2 = __pyx_v_update; __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, 2448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2445
 *         return hash(("Real", self.to_sympy().n(dps(_prec))))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.Real.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__prec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2450
 *         update(b"System`Real>" + str(self.to_sympy().n(dps(_prec))).encode("utf8"))
 * 
 *     def get_atom_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return "Real"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_23get_atom_name(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_4Real_23get_atom_name = {"get_atom_name", (PyCFunction)__pyx_pw_7mathics_4core_10expression_4Real_23get_atom_name, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_4Real_23get_atom_name(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_atom_name (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_4Real_22get_atom_name(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_4Real_22get_atom_name(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_atom_name", 0);

  /* "mathics/core/expression.py":2451
 * 
 *     def get_atom_name(self) -> str:
 *         return "Real"             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_n_u_Real);
  __pyx_r = __pyx_n_u_Real;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2450
 *         update(b"System`Real>" + str(self.to_sympy().n(dps(_prec))).encode("utf8"))
 * 
 *     def get_atom_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return "Real"
 * 
 */

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

/* "mathics/core/expression.py":2463
 *     value: float
 * 
 *     def __new__(cls, value) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         self = Number.__new__(cls)
 *         self.value = float(value)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_11MachineReal_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, 1); __PYX_ERR(0, 2463, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 2463, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_cls = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2463, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal___new__(__pyx_self, __pyx_v_cls, __pyx_v_value);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_self = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);

  /* "mathics/core/expression.py":2464
 * 
 *     def __new__(cls, value) -> "MachineReal":
 *         self = Number.__new__(cls)             # <<<<<<<<<<<<<<
 *         self.value = float(value)
 *         if math.isinf(self.value) or math.isnan(self.value):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Number); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_cls) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cls);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2465
 *     def __new__(cls, value) -> "MachineReal":
 *         self = Number.__new__(cls)
 *         self.value = float(value)             # <<<<<<<<<<<<<<
 *         if math.isinf(self.value) or math.isnan(self.value):
 *             raise OverflowError
 */
  __pyx_t_1 = __Pyx_PyNumber_Float(__pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_t_1) < 0) __PYX_ERR(0, 2465, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2466
 *         self = Number.__new__(cls)
 *         self.value = float(value)
 *         if math.isinf(self.value) or math.isnan(self.value):             # <<<<<<<<<<<<<<
 *             raise OverflowError
 *         return self
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isinf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isnan); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 2466, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_4)) {

    /* "mathics/core/expression.py":2467
 *         self.value = float(value)
 *         if math.isinf(self.value) or math.isnan(self.value):
 *             raise OverflowError             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
    __Pyx_Raise(__pyx_builtin_OverflowError, 0, 0, 0);
    __PYX_ERR(0, 2467, __pyx_L1_error)

    /* "mathics/core/expression.py":2466
 *         self = Number.__new__(cls)
 *         self.value = float(value)
 *         if math.isinf(self.value) or math.isnan(self.value):             # <<<<<<<<<<<<<<
 *             raise OverflowError
 *         return self
 */
  }

  /* "mathics/core/expression.py":2468
 *         if math.isinf(self.value) or math.isnan(self.value):
 *             raise OverflowError
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def to_python(self, *args, **kwargs) -> float:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2463
 *     value: float
 * 
 *     def __new__(cls, value) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         self = Number.__new__(cls)
 *         self.value = float(value)
 */

  /* 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("mathics.core.expression.MachineReal.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2470
 *         return self
 * 
 *     def to_python(self, *args, **kwargs) -> float:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_3to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_3to_python = {"to_python", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_11MachineReal_3to_python, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_3to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED 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("to_python (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_self,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_self)) != 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, "to_python") < 0)) __PYX_ERR(0, 2470, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_python", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2470, __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("mathics.core.expression.MachineReal.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_2to_python(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_2to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  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("to_python", 0);

  /* "mathics/core/expression.py":2471
 * 
 *     def to_python(self, *args, **kwargs) -> float:
 *         return self.value             # <<<<<<<<<<<<<<
 * 
 *     def to_sympy(self, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2470
 *         return self
 * 
 *     def to_python(self, *args, **kwargs) -> float:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2473
 *         return self.value
 * 
 *     def to_sympy(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return sympy.Float(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_5to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_5to_sympy = {"to_sympy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_11MachineReal_5to_sympy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_5to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED 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("to_sympy (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_self,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_self)) != 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, "to_sympy") < 0)) __PYX_ERR(0, 2473, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_sympy", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2473, __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("mathics.core.expression.MachineReal.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_4to_sympy(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_4to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  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("to_sympy", 0);

  /* "mathics/core/expression.py":2474
 * 
 *     def to_sympy(self, *args, **kwargs):
 *         return sympy.Float(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def to_mpmath(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Float); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2474, __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;

  /* "mathics/core/expression.py":2473
 *         return self.value
 * 
 *     def to_sympy(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return sympy.Float(self.value)
 * 
 */

  /* 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("mathics.core.expression.MachineReal.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2476
 *         return sympy.Float(self.value)
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_7to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_7to_mpmath = {"to_mpmath", (PyCFunction)__pyx_pw_7mathics_4core_10expression_11MachineReal_7to_mpmath, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_7to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_mpmath (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_6to_mpmath(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2477
 * 
 *     def to_mpmath(self):
 *         return mpmath.mpf(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def round(self, d=None) -> "MachineReal":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mpf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2477, __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;

  /* "mathics/core/expression.py":2476
 *         return sympy.Float(self.value)
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */

  /* 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("mathics.core.expression.MachineReal.to_mpmath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2479
 *         return mpmath.mpf(self.value)
 * 
 *     def round(self, d=None) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_9round(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_9round = {"round", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_11MachineReal_9round, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_9round(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_d = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("round (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_d,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "round") < 0)) __PYX_ERR(0, 2479, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("round", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2479, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_8round(__pyx_self, __pyx_v_self, __pyx_v_d);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_8round(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("round", 0);

  /* "mathics/core/expression.py":2480
 * 
 *     def round(self, d=None) -> "MachineReal":
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def sameQ(self, other) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2479
 *         return mpmath.mpf(self.value)
 * 
 *     def round(self, d=None) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

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

/* "mathics/core/expression.py":2482
 *         return self
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if isinstance(other, MachineReal):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_11sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_11MachineReal_10sameQ[] = "Mathics SameQ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_11sameQ = {"sameQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_11MachineReal_11sameQ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_11MachineReal_10sameQ};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_11sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sameQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, 1); __PYX_ERR(0, 2482, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sameQ") < 0)) __PYX_ERR(0, 2482, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2482, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_10sameQ(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":2484
 *     def sameQ(self, other) -> bool:
 *         """Mathics SameQ"""
 *         if isinstance(other, MachineReal):             # <<<<<<<<<<<<<<
 *             return self.value == other.value
 *         elif isinstance(other, PrecisionReal):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_other, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":2485
 *         """Mathics SameQ"""
 *         if isinstance(other, MachineReal):
 *             return self.value == other.value             # <<<<<<<<<<<<<<
 *         elif isinstance(other, PrecisionReal):
 *             return self.to_sympy() == other.value
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2485, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2484
 *     def sameQ(self, other) -> bool:
 *         """Mathics SameQ"""
 *         if isinstance(other, MachineReal):             # <<<<<<<<<<<<<<
 *             return self.value == other.value
 *         elif isinstance(other, PrecisionReal):
 */
  }

  /* "mathics/core/expression.py":2486
 *         if isinstance(other, MachineReal):
 *             return self.value == other.value
 *         elif isinstance(other, PrecisionReal):             # <<<<<<<<<<<<<<
 *             return self.to_sympy() == other.value
 *         return False
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PrecisionReal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_other, __pyx_t_5); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2486, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":2487
 *             return self.value == other.value
 *         elif isinstance(other, PrecisionReal):
 *             return self.to_sympy() == other.value             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2487, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2486
 *         if isinstance(other, MachineReal):
 *             return self.value == other.value
 *         elif isinstance(other, PrecisionReal):             # <<<<<<<<<<<<<<
 *             return self.to_sympy() == other.value
 *         return False
 */
  }

  /* "mathics/core/expression.py":2488
 *         elif isinstance(other, PrecisionReal):
 *             return self.to_sympy() == other.value
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def is_machine_precision(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2482
 *         return self
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if isinstance(other, MachineReal):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2490
 *         return False
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_13is_machine_precision(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_13is_machine_precision = {"is_machine_precision", (PyCFunction)__pyx_pw_7mathics_4core_10expression_11MachineReal_13is_machine_precision, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_13is_machine_precision(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_machine_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_12is_machine_precision(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_12is_machine_precision(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_machine_precision", 0);

  /* "mathics/core/expression.py":2491
 * 
 *     def is_machine_precision(self) -> bool:
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def get_precision(self) -> int:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_True);
  __pyx_r = Py_True;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2490
 *         return False
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */

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

/* "mathics/core/expression.py":2493
 *         return True
 * 
 *     def get_precision(self) -> int:             # <<<<<<<<<<<<<<
 *         return machine_precision
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_15get_precision(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_15get_precision = {"get_precision", (PyCFunction)__pyx_pw_7mathics_4core_10expression_11MachineReal_15get_precision, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_15get_precision(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_14get_precision(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2494
 * 
 *     def get_precision(self) -> int:
 *         return machine_precision             # <<<<<<<<<<<<<<
 * 
 *     def get_float_value(self, permit_complex=False) -> float:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_machine_precision); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2493
 *         return True
 * 
 *     def get_precision(self) -> int:             # <<<<<<<<<<<<<<
 *         return machine_precision
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.get_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2496
 *         return machine_precision
 * 
 *     def get_float_value(self, permit_complex=False) -> float:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_17get_float_value(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_17get_float_value = {"get_float_value", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_11MachineReal_17get_float_value, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_17get_float_value(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_permit_complex = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_float_value (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_permit_complex,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_permit_complex);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_float_value") < 0)) __PYX_ERR(0, 2496, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_permit_complex = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_float_value", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2496, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.get_float_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_16get_float_value(__pyx_self, __pyx_v_self, __pyx_v_permit_complex);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_16get_float_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_permit_complex) {
  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_float_value", 0);

  /* "mathics/core/expression.py":2497
 * 
 *     def get_float_value(self, permit_complex=False) -> float:
 *         return self.value             # <<<<<<<<<<<<<<
 * 
 *     def make_boxes(self, form):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2496
 *         return machine_precision
 * 
 *     def get_float_value(self, permit_complex=False) -> float:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.get_float_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2499
 *         return self.value
 * 
 *     def make_boxes(self, form):             # <<<<<<<<<<<<<<
 *         from mathics.builtin.inout import number_form
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_19make_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_19make_boxes = {"make_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_11MachineReal_19make_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_19make_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_form,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_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("make_boxes", 1, 2, 2, 1); __PYX_ERR(0, 2499, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "make_boxes") < 0)) __PYX_ERR(0, 2499, __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_form = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("make_boxes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2499, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.make_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_18make_boxes(__pyx_self, __pyx_v_self, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_11MachineReal_18make_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_form) {
  PyObject *__pyx_v_number_form = NULL;
  PyObject *__pyx_v_n = NULL;
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_boxes", 0);

  /* "mathics/core/expression.py":2500
 * 
 *     def make_boxes(self, form):
 *         from mathics.builtin.inout import number_form             # <<<<<<<<<<<<<<
 * 
 *         _number_form_options["_Form"] = form  # passed to _NumberFormat
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_number_form);
  __Pyx_GIVEREF(__pyx_n_s_number_form);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_number_form);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_builtin_inout, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2500, __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_number_form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_number_form = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2502
 *         from mathics.builtin.inout import number_form
 * 
 *         _number_form_options["_Form"] = form  # passed to _NumberFormat             # <<<<<<<<<<<<<<
 *         if form in ("System`InputForm", "System`FullForm"):
 *             n = None
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_number_form_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_Form, __pyx_v_form) < 0)) __PYX_ERR(0, 2502, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2503
 * 
 *         _number_form_options["_Form"] = form  # passed to _NumberFormat
 *         if form in ("System`InputForm", "System`FullForm"):             # <<<<<<<<<<<<<<
 *             n = None
 *         else:
 */
  __Pyx_INCREF(__pyx_v_form);
  __pyx_t_2 = __pyx_v_form;
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_InputForm, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2503, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_FullForm, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2503, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2504
 *         _number_form_options["_Form"] = form  # passed to _NumberFormat
 *         if form in ("System`InputForm", "System`FullForm"):
 *             n = None             # <<<<<<<<<<<<<<
 *         else:
 *             n = 6
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_n = Py_None;

    /* "mathics/core/expression.py":2503
 * 
 *         _number_form_options["_Form"] = form  # passed to _NumberFormat
 *         if form in ("System`InputForm", "System`FullForm"):             # <<<<<<<<<<<<<<
 *             n = None
 *         else:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":2506
 *             n = None
 *         else:
 *             n = 6             # <<<<<<<<<<<<<<
 *         return number_form(self, n, None, None, _number_form_options)
 * 
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_int_6);
    __pyx_v_n = __pyx_int_6;
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":2507
 *         else:
 *             n = 6
 *         return number_form(self, n, None, None, _number_form_options)             # <<<<<<<<<<<<<<
 * 
 *     def __getnewargs__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_number_form_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_number_form);
  __pyx_t_5 = __pyx_v_number_form; __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[6] = {__pyx_t_6, __pyx_v_self, __pyx_v_n, Py_None, Py_None, __pyx_t_1};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2507, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[6] = {__pyx_t_6, __pyx_v_self, __pyx_v_n, Py_None, Py_None, __pyx_t_1};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2507, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2507, __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_n);
    __Pyx_GIVEREF(__pyx_v_n);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_n);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, Py_None);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, Py_None);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2507, __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_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2499
 *         return self.value
 * 
 *     def make_boxes(self, form):             # <<<<<<<<<<<<<<
 *         from mathics.builtin.inout import number_form
 * 
 */

  /* 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_8);
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.make_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_number_form);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2509
 *         return number_form(self, n, None, None, _number_form_options)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_21__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_21__getnewargs__ = {"__getnewargs__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_11MachineReal_21__getnewargs__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_21__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getnewargs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_20__getnewargs__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2510
 * 
 *     def __getnewargs__(self):
 *         return (self.value,)             # <<<<<<<<<<<<<<
 * 
 *     def do_copy(self) -> "MachineReal":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2510, __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_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2509
 *         return number_form(self, n, None, None, _number_form_options)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */

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

/* "mathics/core/expression.py":2512
 *         return (self.value,)
 * 
 *     def do_copy(self) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return MachineReal(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_23do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_23do_copy = {"do_copy", (PyCFunction)__pyx_pw_7mathics_4core_10expression_11MachineReal_23do_copy, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_23do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_22do_copy(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2513
 * 
 *     def do_copy(self) -> "MachineReal":
 *         return MachineReal(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self) -> "MachineReal":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2513, __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;

  /* "mathics/core/expression.py":2512
 *         return (self.value,)
 * 
 *     def do_copy(self) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return MachineReal(self.value)
 * 
 */

  /* 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("mathics.core.expression.MachineReal.do_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2515
 *         return MachineReal(self.value)
 * 
 *     def __neg__(self) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return MachineReal(-self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_25__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_25__neg__ = {"__neg__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_11MachineReal_25__neg__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_25__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_24__neg__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2516
 * 
 *     def __neg__(self) -> "MachineReal":
 *         return MachineReal(-self.value)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2516, __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, 2516, __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;

  /* "mathics/core/expression.py":2515
 *         return MachineReal(self.value)
 * 
 *     def __neg__(self) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return MachineReal(-self.value)
 * 
 */

  /* 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("mathics.core.expression.MachineReal.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2519
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0.0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_27is_zero(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_27is_zero = {"is_zero", (PyCFunction)__pyx_pw_7mathics_4core_10expression_11MachineReal_27is_zero, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_27is_zero(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_zero (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_26is_zero(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2520
 *     @property
 *     def is_zero(self) -> bool:
 *         return self.value == 0.0             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyFloat_EqObjC(__pyx_t_1, __pyx_float_0_0, 0.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2520, __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;

  /* "mathics/core/expression.py":2519
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0.0
 * 
 */

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

/* "mathics/core/expression.py":2523
 * 
 *     @property
 *     def is_approx_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         # In WMA, Chop[10.^(-10)] == 0,
 *         # so, lets take it.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_29is_approx_zero(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_11MachineReal_29is_approx_zero = {"is_approx_zero", (PyCFunction)__pyx_pw_7mathics_4core_10expression_11MachineReal_29is_approx_zero, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_11MachineReal_29is_approx_zero(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_approx_zero (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_11MachineReal_28is_approx_zero(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2526
 *         # In WMA, Chop[10.^(-10)] == 0,
 *         # so, lets take it.
 *         res = abs(self.value) <= 1e-10             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_float_1eneg_10, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2527
 *         # so, lets take it.
 *         res = abs(self.value) <= 1e-10
 *         return res             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2523
 * 
 *     @property
 *     def is_approx_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         # In WMA, Chop[10.^(-10)] == 0,
 *         # so, lets take it.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.core.expression.MachineReal.is_approx_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2541
 *     value: sympy.Float
 * 
 *     def __new__(cls, value) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         self = Number.__new__(cls)
 *         self.value = sympy.Float(value)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, 1); __PYX_ERR(0, 2541, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 2541, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_cls = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2541, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.PrecisionReal.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal___new__(__pyx_self, __pyx_v_cls, __pyx_v_value);

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

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

  /* "mathics/core/expression.py":2542
 * 
 *     def __new__(cls, value) -> "PrecisionReal":
 *         self = Number.__new__(cls)             # <<<<<<<<<<<<<<
 *         self.value = sympy.Float(value)
 *         return self
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Number); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_cls) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cls);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 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_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2543
 *     def __new__(cls, value) -> "PrecisionReal":
 *         self = Number.__new__(cls)
 *         self.value = sympy.Float(value)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sympy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Float); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2543, __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 && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_value);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_t_1) < 0) __PYX_ERR(0, 2543, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2544
 *         self = Number.__new__(cls)
 *         self.value = sympy.Float(value)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def to_python(self, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2541
 *     value: sympy.Float
 * 
 *     def __new__(cls, value) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         self = Number.__new__(cls)
 *         self.value = sympy.Float(value)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.PrecisionReal.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2546
 *         return self
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return float(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_3to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_3to_python = {"to_python", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_3to_python, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_3to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED 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("to_python (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_self,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_self)) != 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, "to_python") < 0)) __PYX_ERR(0, 2546, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_python", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2546, __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("mathics.core.expression.PrecisionReal.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_2to_python(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_2to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  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("to_python", 0);

  /* "mathics/core/expression.py":2547
 * 
 *     def to_python(self, *args, **kwargs):
 *         return float(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def to_sympy(self, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyNumber_Float(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2547, __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;

  /* "mathics/core/expression.py":2546
 *         return self
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return float(self.value)
 * 
 */

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

/* "mathics/core/expression.py":2549
 *         return float(self.value)
 * 
 *     def to_sympy(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_5to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_5to_sympy = {"to_sympy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_5to_sympy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_5to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED 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("to_sympy (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_self,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_self)) != 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, "to_sympy") < 0)) __PYX_ERR(0, 2549, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_sympy", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2549, __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("mathics.core.expression.PrecisionReal.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_4to_sympy(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_4to_sympy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  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("to_sympy", 0);

  /* "mathics/core/expression.py":2550
 * 
 *     def to_sympy(self, *args, **kwargs):
 *         return self.value             # <<<<<<<<<<<<<<
 * 
 *     def to_mpmath(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2549
 *         return float(self.value)
 * 
 *     def to_sympy(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.PrecisionReal.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2552
 *         return self.value
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_7to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_7to_mpmath = {"to_mpmath", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_7to_mpmath, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_7to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_mpmath (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_6to_mpmath(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2553
 * 
 *     def to_mpmath(self):
 *         return mpmath.mpf(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mpf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2553, __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;

  /* "mathics/core/expression.py":2552
 *         return self.value
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */

  /* 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("mathics.core.expression.PrecisionReal.to_mpmath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2555
 *         return mpmath.mpf(self.value)
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_9round(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_9round = {"round", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_9round, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_9round(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_d = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("round (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_d,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "round") < 0)) __PYX_ERR(0, 2555, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("round", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2555, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.PrecisionReal.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_8round(__pyx_self, __pyx_v_self, __pyx_v_d);

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

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

  /* "mathics/core/expression.py":2556
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 *         if d is None:             # <<<<<<<<<<<<<<
 *             return MachineReal(float(self.value))
 *         else:
 */
  __pyx_t_1 = (__pyx_v_d == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":2557
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 *         if d is None:
 *             return MachineReal(float(self.value))             # <<<<<<<<<<<<<<
 *         else:
 *             d = min(dps(self.get_precision()), d)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyNumber_Float(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2557, __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, 2557, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2556
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:
 *         if d is None:             # <<<<<<<<<<<<<<
 *             return MachineReal(float(self.value))
 *         else:
 */
  }

  /* "mathics/core/expression.py":2559
 *             return MachineReal(float(self.value))
 *         else:
 *             d = min(dps(self.get_precision()), d)             # <<<<<<<<<<<<<<
 *             return PrecisionReal(self.value.n(d))
 * 
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_d);
    __pyx_t_3 = __pyx_v_d;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_dps); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2559, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2559, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2559, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_2) {
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_6 = __pyx_t_3;
    } else {
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6 = __pyx_t_4;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":2560
 *         else:
 *             d = min(dps(self.get_precision()), d)
 *             return PrecisionReal(self.value.n(d))             # <<<<<<<<<<<<<<
 * 
 *     def sameQ(self, other) -> bool:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PrecisionReal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_v_d) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_d);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2555
 *         return mpmath.mpf(self.value)
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.core.expression.PrecisionReal.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2562
 *             return PrecisionReal(self.value.n(d))
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if isinstance(other, PrecisionReal):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_11sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_13PrecisionReal_10sameQ[] = "Mathics SameQ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_11sameQ = {"sameQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_11sameQ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_13PrecisionReal_10sameQ};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_11sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sameQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, 1); __PYX_ERR(0, 2562, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sameQ") < 0)) __PYX_ERR(0, 2562, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2562, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.PrecisionReal.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_10sameQ(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":2564
 *     def sameQ(self, other) -> bool:
 *         """Mathics SameQ"""
 *         if isinstance(other, PrecisionReal):             # <<<<<<<<<<<<<<
 *             return self.value == other.value
 *         elif isinstance(other, MachineReal):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_PrecisionReal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_other, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":2565
 *         """Mathics SameQ"""
 *         if isinstance(other, PrecisionReal):
 *             return self.value == other.value             # <<<<<<<<<<<<<<
 *         elif isinstance(other, MachineReal):
 *             return self.value == other.to_sympy()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2565, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2564
 *     def sameQ(self, other) -> bool:
 *         """Mathics SameQ"""
 *         if isinstance(other, PrecisionReal):             # <<<<<<<<<<<<<<
 *             return self.value == other.value
 *         elif isinstance(other, MachineReal):
 */
  }

  /* "mathics/core/expression.py":2566
 *         if isinstance(other, PrecisionReal):
 *             return self.value == other.value
 *         elif isinstance(other, MachineReal):             # <<<<<<<<<<<<<<
 *             return self.value == other.to_sympy()
 *         return False
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_other, __pyx_t_5); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2566, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":2567
 *             return self.value == other.value
 *         elif isinstance(other, MachineReal):
 *             return self.value == other.to_sympy()             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2567, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2566
 *         if isinstance(other, PrecisionReal):
 *             return self.value == other.value
 *         elif isinstance(other, MachineReal):             # <<<<<<<<<<<<<<
 *             return self.value == other.to_sympy()
 *         return False
 */
  }

  /* "mathics/core/expression.py":2568
 *         elif isinstance(other, MachineReal):
 *             return self.value == other.to_sympy()
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def get_precision(self) -> int:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2562
 *             return PrecisionReal(self.value.n(d))
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if isinstance(other, PrecisionReal):
 */

  /* 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("mathics.core.expression.PrecisionReal.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2570
 *         return False
 * 
 *     def get_precision(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.value._prec + 1
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_13get_precision(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_13get_precision = {"get_precision", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_13get_precision, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_13get_precision(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_12get_precision(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2571
 * 
 *     def get_precision(self) -> int:
 *         return self.value._prec + 1             # <<<<<<<<<<<<<<
 * 
 *     def make_boxes(self, form):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_prec_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2571, __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;

  /* "mathics/core/expression.py":2570
 *         return False
 * 
 *     def get_precision(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.value._prec + 1
 * 
 */

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

/* "mathics/core/expression.py":2573
 *         return self.value._prec + 1
 * 
 *     def make_boxes(self, form):             # <<<<<<<<<<<<<<
 *         from mathics.builtin.inout import number_form
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_15make_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_15make_boxes = {"make_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_15make_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_15make_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("make_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_form,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_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("make_boxes", 1, 2, 2, 1); __PYX_ERR(0, 2573, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "make_boxes") < 0)) __PYX_ERR(0, 2573, __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_form = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("make_boxes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2573, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.PrecisionReal.make_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_14make_boxes(__pyx_self, __pyx_v_self, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13PrecisionReal_14make_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_form) {
  PyObject *__pyx_v_number_form = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("make_boxes", 0);

  /* "mathics/core/expression.py":2574
 * 
 *     def make_boxes(self, form):
 *         from mathics.builtin.inout import number_form             # <<<<<<<<<<<<<<
 * 
 *         _number_form_options["_Form"] = form  # passed to _NumberFormat
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_number_form);
  __Pyx_GIVEREF(__pyx_n_s_number_form);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_number_form);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_builtin_inout, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2574, __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_number_form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_number_form = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2576
 *         from mathics.builtin.inout import number_form
 * 
 *         _number_form_options["_Form"] = form  # passed to _NumberFormat             # <<<<<<<<<<<<<<
 *         return number_form(
 *             self, dps(self.get_precision()), None, None, _number_form_options
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_number_form_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_Form, __pyx_v_form) < 0)) __PYX_ERR(0, 2576, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2577
 * 
 *         _number_form_options["_Form"] = form  # passed to _NumberFormat
 *         return number_form(             # <<<<<<<<<<<<<<
 *             self, dps(self.get_precision()), None, None, _number_form_options
 *         )
 */
  __Pyx_XDECREF(__pyx_r);

  /* "mathics/core/expression.py":2578
 *         _number_form_options["_Form"] = form  # passed to _NumberFormat
 *         return number_form(
 *             self, dps(self.get_precision()), None, None, _number_form_options             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_dps); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_number_form_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_number_form);
  __pyx_t_4 = __pyx_v_number_form; __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[6] = {__pyx_t_5, __pyx_v_self, __pyx_t_1, Py_None, Py_None, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2577, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_self, __pyx_t_1, Py_None, Py_None, __pyx_t_3};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2577, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2577, __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_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_1);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, Py_None);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, Py_None);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_t_3);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2577, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2573
 *         return self.value._prec + 1
 * 
 *     def make_boxes(self, form):             # <<<<<<<<<<<<<<
 *         from mathics.builtin.inout import number_form
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.PrecisionReal.make_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_number_form);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2581
 *         )
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_17__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_17__getnewargs__ = {"__getnewargs__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_17__getnewargs__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_17__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getnewargs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_16__getnewargs__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2582
 * 
 *     def __getnewargs__(self):
 *         return (self.value,)             # <<<<<<<<<<<<<<
 * 
 *     def do_copy(self) -> "PrecisionReal":
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2582, __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_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2581
 *         )
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */

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

/* "mathics/core/expression.py":2584
 *         return (self.value,)
 * 
 *     def do_copy(self) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         return PrecisionReal(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_19do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_19do_copy = {"do_copy", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_19do_copy, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_19do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_18do_copy(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2585
 * 
 *     def do_copy(self) -> "PrecisionReal":
 *         return PrecisionReal(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self) -> "PrecisionReal":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PrecisionReal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2585, __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;

  /* "mathics/core/expression.py":2584
 *         return (self.value,)
 * 
 *     def do_copy(self) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         return PrecisionReal(self.value)
 * 
 */

  /* 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("mathics.core.expression.PrecisionReal.do_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2587
 *         return PrecisionReal(self.value)
 * 
 *     def __neg__(self) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         return PrecisionReal(-self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_21__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_21__neg__ = {"__neg__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_21__neg__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_21__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_20__neg__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2588
 * 
 *     def __neg__(self) -> "PrecisionReal":
 *         return PrecisionReal(-self.value)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_PrecisionReal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2588, __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, 2588, __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;

  /* "mathics/core/expression.py":2587
 *         return PrecisionReal(self.value)
 * 
 *     def __neg__(self) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         return PrecisionReal(-self.value)
 * 
 */

  /* 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("mathics.core.expression.PrecisionReal.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2591
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0.0
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_23is_zero(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13PrecisionReal_23is_zero = {"is_zero", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13PrecisionReal_23is_zero, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13PrecisionReal_23is_zero(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_zero (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13PrecisionReal_22is_zero(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2592
 *     @property
 *     def is_zero(self) -> bool:
 *         return self.value == 0.0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyFloat_EqObjC(__pyx_t_1, __pyx_float_0_0, 0.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2592, __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;

  /* "mathics/core/expression.py":2591
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0.0
 * 
 */

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

/* "mathics/core/expression.py":2603
 *     imag: Any
 * 
 *     def __new__(cls, real, imag):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if isinstance(real, Complex) or not isinstance(real, Number):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_real = 0;
  PyObject *__pyx_v_imag = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_real,&__pyx_n_s_imag,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_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_real)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 1, 3, 3, 1); __PYX_ERR(0, 2603, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_imag)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 1, 3, 3, 2); __PYX_ERR(0, 2603, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 2603, __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_cls = values[0];
    __pyx_v_real = values[1];
    __pyx_v_imag = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2603, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex___new__(__pyx_self, __pyx_v_cls, __pyx_v_real, __pyx_v_imag);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_real, PyObject *__pyx_v_imag) {
  PyObject *__pyx_v_self = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);
  __Pyx_INCREF(__pyx_v_real);
  __Pyx_INCREF(__pyx_v_imag);

  /* "mathics/core/expression.py":2604
 * 
 *     def __new__(cls, real, imag):
 *         self = super().__new__(cls)             # <<<<<<<<<<<<<<
 *         if isinstance(real, Complex) or not isinstance(real, Number):
 *             raise ValueError("Argument 'real' must be a real number.")
 */
  __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 2604, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_cls);
  __Pyx_GIVEREF(__pyx_v_cls);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cls);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_cls) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cls);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2605
 *     def __new__(cls, real, imag):
 *         self = super().__new__(cls)
 *         if isinstance(real, Complex) or not isinstance(real, Number):             # <<<<<<<<<<<<<<
 *             raise ValueError("Argument 'real' must be a real number.")
 *         if isinstance(imag, Complex) or not isinstance(imag, Number):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Complex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_real, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 2605, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Number); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyObject_IsInstance(__pyx_v_real, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 2605, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_4)) {

    /* "mathics/core/expression.py":2606
 *         self = super().__new__(cls)
 *         if isinstance(real, Complex) or not isinstance(real, Number):
 *             raise ValueError("Argument 'real' must be a real number.")             # <<<<<<<<<<<<<<
 *         if isinstance(imag, Complex) or not isinstance(imag, Number):
 *             raise ValueError("Argument 'imag' must be a real number.")
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__77, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 2606, __pyx_L1_error)

    /* "mathics/core/expression.py":2605
 *     def __new__(cls, real, imag):
 *         self = super().__new__(cls)
 *         if isinstance(real, Complex) or not isinstance(real, Number):             # <<<<<<<<<<<<<<
 *             raise ValueError("Argument 'real' must be a real number.")
 *         if isinstance(imag, Complex) or not isinstance(imag, Number):
 */
  }

  /* "mathics/core/expression.py":2607
 *         if isinstance(real, Complex) or not isinstance(real, Number):
 *             raise ValueError("Argument 'real' must be a real number.")
 *         if isinstance(imag, Complex) or not isinstance(imag, Number):             # <<<<<<<<<<<<<<
 *             raise ValueError("Argument 'imag' must be a real number.")
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Complex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_imag, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 2607, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L7_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Number); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyObject_IsInstance(__pyx_v_imag, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 2607, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L7_bool_binop_done:;
  if (unlikely(__pyx_t_4)) {

    /* "mathics/core/expression.py":2608
 *             raise ValueError("Argument 'real' must be a real number.")
 *         if isinstance(imag, Complex) or not isinstance(imag, Number):
 *             raise ValueError("Argument 'imag' must be a real number.")             # <<<<<<<<<<<<<<
 * 
 *         if imag.sameQ(Integer0):
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__78, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 2608, __pyx_L1_error)

    /* "mathics/core/expression.py":2607
 *         if isinstance(real, Complex) or not isinstance(real, Number):
 *             raise ValueError("Argument 'real' must be a real number.")
 *         if isinstance(imag, Complex) or not isinstance(imag, Number):             # <<<<<<<<<<<<<<
 *             raise ValueError("Argument 'imag' must be a real number.")
 * 
 */
  }

  /* "mathics/core/expression.py":2610
 *             raise ValueError("Argument 'imag' must be a real number.")
 * 
 *         if imag.sameQ(Integer0):             # <<<<<<<<<<<<<<
 *             return real
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_imag, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Integer0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2610, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2611
 * 
 *         if imag.sameQ(Integer0):
 *             return real             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(real, MachineReal) and not isinstance(imag, MachineReal):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_real);
    __pyx_r = __pyx_v_real;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2610
 *             raise ValueError("Argument 'imag' must be a real number.")
 * 
 *         if imag.sameQ(Integer0):             # <<<<<<<<<<<<<<
 *             return real
 * 
 */
  }

  /* "mathics/core/expression.py":2613
 *             return real
 * 
 *         if isinstance(real, MachineReal) and not isinstance(imag, MachineReal):             # <<<<<<<<<<<<<<
 *             imag = imag.round()
 *         if isinstance(imag, MachineReal) and not isinstance(real, MachineReal):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_real, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 2613, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L11_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyObject_IsInstance(__pyx_v_imag, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 2613, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L11_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2614
 * 
 *         if isinstance(real, MachineReal) and not isinstance(imag, MachineReal):
 *             imag = imag.round()             # <<<<<<<<<<<<<<
 *         if isinstance(imag, MachineReal) and not isinstance(real, MachineReal):
 *             real = real.round()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_imag, __pyx_n_s_round); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_imag, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":2613
 *             return real
 * 
 *         if isinstance(real, MachineReal) and not isinstance(imag, MachineReal):             # <<<<<<<<<<<<<<
 *             imag = imag.round()
 *         if isinstance(imag, MachineReal) and not isinstance(real, MachineReal):
 */
  }

  /* "mathics/core/expression.py":2615
 *         if isinstance(real, MachineReal) and not isinstance(imag, MachineReal):
 *             imag = imag.round()
 *         if isinstance(imag, MachineReal) and not isinstance(real, MachineReal):             # <<<<<<<<<<<<<<
 *             real = real.round()
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_imag, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 2615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L14_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyObject_IsInstance(__pyx_v_real, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 2615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!(__pyx_t_6 != 0)) != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2616
 *             imag = imag.round()
 *         if isinstance(imag, MachineReal) and not isinstance(real, MachineReal):
 *             real = real.round()             # <<<<<<<<<<<<<<
 * 
 *         self.real = real
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_real, __pyx_n_s_round); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_real, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":2615
 *         if isinstance(real, MachineReal) and not isinstance(imag, MachineReal):
 *             imag = imag.round()
 *         if isinstance(imag, MachineReal) and not isinstance(real, MachineReal):             # <<<<<<<<<<<<<<
 *             real = real.round()
 * 
 */
  }

  /* "mathics/core/expression.py":2618
 *             real = real.round()
 * 
 *         self.real = real             # <<<<<<<<<<<<<<
 *         self.imag = imag
 *         return self
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_real, __pyx_v_real) < 0) __PYX_ERR(0, 2618, __pyx_L1_error)

  /* "mathics/core/expression.py":2619
 * 
 *         self.real = real
 *         self.imag = imag             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_imag, __pyx_v_imag) < 0) __PYX_ERR(0, 2619, __pyx_L1_error)

  /* "mathics/core/expression.py":2620
 *         self.real = real
 *         self.imag = imag
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def atom_to_boxes(self, f, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2603
 *     imag: Any
 * 
 *     def __new__(cls, real, imag):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if isinstance(real, Complex) or not isinstance(real, Number):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.Complex.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XDECREF(__pyx_v_real);
  __Pyx_XDECREF(__pyx_v_imag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2622
 *         return self
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.format(evaluation, f.get_name())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_3atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_3atom_to_boxes = {"atom_to_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_3atom_to_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_3atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atom_to_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_f,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 1); __PYX_ERR(0, 2622, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 2); __PYX_ERR(0, 2622, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atom_to_boxes") < 0)) __PYX_ERR(0, 2622, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_f = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2622, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_2atom_to_boxes(__pyx_self, __pyx_v_self, __pyx_v_f, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_2atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("atom_to_boxes", 0);

  /* "mathics/core/expression.py":2623
 * 
 *     def atom_to_boxes(self, f, evaluation):
 *         return self.format(evaluation, f.get_name())             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_get_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2623, __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, 2623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_evaluation, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2623, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_evaluation, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2623, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2623, __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;

  /* "mathics/core/expression.py":2622
 *         return self
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.format(evaluation, f.get_name())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Complex.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2625
 *         return self.format(evaluation, f.get_name())
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.to_sympy())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_5__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_5__str__ = {"__str__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Complex_5__str__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_5__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_4__str__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2626
 * 
 *     def __str__(self) -> str:
 *         return str(self.to_sympy())             # <<<<<<<<<<<<<<
 * 
 *     def to_sympy(self, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2626, __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, 2626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2625
 *         return self.format(evaluation, f.get_name())
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.to_sympy())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Complex.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2628
 *         return str(self.to_sympy())
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.real.to_sympy() + sympy.I * self.imag.to_sympy()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_7to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_7to_sympy = {"to_sympy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_7to_sympy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_7to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED 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("to_sympy (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "to_sympy") < 0)) __PYX_ERR(0, 2628, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_sympy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2628, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.Complex.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_6to_sympy(__pyx_self, __pyx_v_self, __pyx_v_kwargs);

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

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

  /* "mathics/core/expression.py":2629
 * 
 *     def to_sympy(self, **kwargs):
 *         return self.real.to_sympy() + sympy.I * self.imag.to_sympy()             # <<<<<<<<<<<<<<
 * 
 *     def to_python(self, *args, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sympy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_I); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__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_3)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2628
 *         return str(self.to_sympy())
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.real.to_sympy() + sympy.I * self.imag.to_sympy()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Complex.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2631
 *         return self.real.to_sympy() + sympy.I * self.imag.to_sympy()
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return complex(
 *             self.real.to_python(*args, **kwargs), self.imag.to_python(*args, **kwargs)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_9to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_9to_python = {"to_python", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_9to_python, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_9to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 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("to_python (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_self,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_self)) != 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, "to_python") < 0)) __PYX_ERR(0, 2631, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_python", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2631, __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("mathics.core.expression.Complex.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_8to_python(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_8to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  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("to_python", 0);

  /* "mathics/core/expression.py":2632
 * 
 *     def to_python(self, *args, **kwargs):
 *         return complex(             # <<<<<<<<<<<<<<
 *             self.real.to_python(*args, **kwargs), self.imag.to_python(*args, **kwargs)
 *         )
 */
  __Pyx_XDECREF(__pyx_r);

  /* "mathics/core/expression.py":2633
 *     def to_python(self, *args, **kwargs):
 *         return complex(
 *             self.real.to_python(*args, **kwargs), self.imag.to_python(*args, **kwargs)             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_to_python); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_v_args, __pyx_v_kwargs); 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_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_to_python); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2633, __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_3, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":2632
 * 
 *     def to_python(self, *args, **kwargs):
 *         return complex(             # <<<<<<<<<<<<<<
 *             self.real.to_python(*args, **kwargs), self.imag.to_python(*args, **kwargs)
 *         )
 */
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2631
 *         return self.real.to_sympy() + sympy.I * self.imag.to_sympy()
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return complex(
 *             self.real.to_python(*args, **kwargs), self.imag.to_python(*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("mathics.core.expression.Complex.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2636
 *         )
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpc(self.real.to_mpmath(), self.imag.to_mpmath())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_11to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_11to_mpmath = {"to_mpmath", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Complex_11to_mpmath, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_11to_mpmath(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_mpmath (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_10to_mpmath(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2637
 * 
 *     def to_mpmath(self):
 *         return mpmath.mpc(self.real.to_mpmath(), self.imag.to_mpmath())             # <<<<<<<<<<<<<<
 * 
 *     def do_format(self, evaluation, form) -> "Expression":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mpc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_to_mpmath); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_2 = (__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_2)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_to_mpmath); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2637, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2637, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2636
 *         )
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpc(self.real.to_mpmath(), self.imag.to_mpmath())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.Complex.to_mpmath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2639
 *         return mpmath.mpc(self.real.to_mpmath(), self.imag.to_mpmath())
 * 
 *     def do_format(self, evaluation, form) -> "Expression":             # <<<<<<<<<<<<<<
 *         if form == "System`FullForm":
 *             return Expression(
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_13do_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_13do_format = {"do_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_13do_format, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_13do_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, 1); __PYX_ERR(0, 2639, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, 2); __PYX_ERR(0, 2639, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "do_format") < 0)) __PYX_ERR(0, 2639, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("do_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2639, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.do_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_12do_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_12do_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form) {
  PyObject *__pyx_v_parts = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("do_format", 0);

  /* "mathics/core/expression.py":2640
 * 
 *     def do_format(self, evaluation, form) -> "Expression":
 *         if form == "System`FullForm":             # <<<<<<<<<<<<<<
 *             return Expression(
 *                 Expression("HoldForm", Symbol("Complex")), self.real, self.imag
 */
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_form, __pyx_kp_u_System_FullForm, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2640, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2641
 *     def do_format(self, evaluation, form) -> "Expression":
 *         if form == "System`FullForm":
 *             return Expression(             # <<<<<<<<<<<<<<
 *                 Expression("HoldForm", Symbol("Complex")), self.real, self.imag
 *             ).do_format(evaluation, form)
 */
    __Pyx_XDECREF(__pyx_r);

    /* "mathics/core/expression.py":2643
 *             return Expression(
 *                 Expression("HoldForm", Symbol("Complex")), self.real, self.imag
 *             ).do_format(evaluation, form)             # <<<<<<<<<<<<<<
 * 
 *         parts: typing.List[Any] = []
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2641, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "mathics/core/expression.py":2642
 *         if form == "System`FullForm":
 *             return Expression(
 *                 Expression("HoldForm", Symbol("Complex")), self.real, self.imag             # <<<<<<<<<<<<<<
 *             ).do_format(evaluation, form)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Expression); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_n_u_Complex) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_n_u_Complex);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_u_HoldForm, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2642, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_n_u_HoldForm, __pyx_t_7};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2642, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2642, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_HoldForm);
      __Pyx_GIVEREF(__pyx_n_u_HoldForm);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_n_u_HoldForm);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2642, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2642, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_5, __pyx_t_6, __pyx_t_9};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2641, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_5, __pyx_t_6, __pyx_t_9};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2641, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_10, __pyx_t_9);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_9 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2641, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "mathics/core/expression.py":2643
 *             return Expression(
 *                 Expression("HoldForm", Symbol("Complex")), self.real, self.imag
 *             ).do_format(evaluation, form)             # <<<<<<<<<<<<<<
 * 
 *         parts: typing.List[Any] = []
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_do_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(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_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_evaluation, __pyx_v_form};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2643, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_evaluation, __pyx_v_form};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2643, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2643, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_v_evaluation);
      __Pyx_INCREF(__pyx_v_form);
      __Pyx_GIVEREF(__pyx_v_form);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_form);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2643, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2640
 * 
 *     def do_format(self, evaluation, form) -> "Expression":
 *         if form == "System`FullForm":             # <<<<<<<<<<<<<<
 *             return Expression(
 *                 Expression("HoldForm", Symbol("Complex")), self.real, self.imag
 */
  }

  /* "mathics/core/expression.py":2645
 *             ).do_format(evaluation, form)
 * 
 *         parts: typing.List[Any] = []             # <<<<<<<<<<<<<<
 *         if self.is_machine_precision() or not self.real.is_zero:
 *             parts.append(self.real)
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_parts = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2646
 * 
 *         parts: typing.List[Any] = []
 *         if self.is_machine_precision() or not self.real.is_zero:             # <<<<<<<<<<<<<<
 *             parts.append(self.real)
 *         if self.imag.sameQ(Integer(1)):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_is_machine_precision); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 2646, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_11) {
  } else {
    __pyx_t_1 = __pyx_t_11;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_zero); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 2646, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_12 = ((!__pyx_t_11) != 0);
  __pyx_t_1 = __pyx_t_12;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2647
 *         parts: typing.List[Any] = []
 *         if self.is_machine_precision() or not self.real.is_zero:
 *             parts.append(self.real)             # <<<<<<<<<<<<<<
 *         if self.imag.sameQ(Integer(1)):
 *             parts.append(Symbol("I"))
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2647, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_4); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 2647, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "mathics/core/expression.py":2646
 * 
 *         parts: typing.List[Any] = []
 *         if self.is_machine_precision() or not self.real.is_zero:             # <<<<<<<<<<<<<<
 *             parts.append(self.real)
 *         if self.imag.sameQ(Integer(1)):
 */
  }

  /* "mathics/core/expression.py":2648
 *         if self.is_machine_precision() or not self.real.is_zero:
 *             parts.append(self.real)
 *         if self.imag.sameQ(Integer(1)):             # <<<<<<<<<<<<<<
 *             parts.append(Symbol("I"))
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Integer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_1);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2648, __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_8))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2648, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2649
 *             parts.append(self.real)
 *         if self.imag.sameQ(Integer(1)):
 *             parts.append(Symbol("I"))             # <<<<<<<<<<<<<<
 *         else:
 *             parts.append(Expression("Times", self.imag, Symbol("I")))
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_2, __pyx_n_u_I) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_n_u_I);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_4); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 2649, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "mathics/core/expression.py":2648
 *         if self.is_machine_precision() or not self.real.is_zero:
 *             parts.append(self.real)
 *         if self.imag.sameQ(Integer(1)):             # <<<<<<<<<<<<<<
 *             parts.append(Symbol("I"))
 *         else:
 */
    goto __pyx_L7;
  }

  /* "mathics/core/expression.py":2651
 *             parts.append(Symbol("I"))
 *         else:
 *             parts.append(Expression("Times", self.imag, Symbol("I")))             # <<<<<<<<<<<<<<
 * 
 *         if len(parts) == 1:
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Expression); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_6, __pyx_n_u_I) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_n_u_I);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2651, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_n_u_Times, __pyx_t_2, __pyx_t_3};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2651, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_n_u_Times, __pyx_t_2, __pyx_t_3};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2651, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_Times);
      __Pyx_GIVEREF(__pyx_n_u_Times);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_10, __pyx_n_u_Times);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_10, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_10, __pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_4); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 2651, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L7:;

  /* "mathics/core/expression.py":2653
 *             parts.append(Expression("Times", self.imag, Symbol("I")))
 * 
 *         if len(parts) == 1:             # <<<<<<<<<<<<<<
 *             result = parts[0]
 *         else:
 */
  __pyx_t_14 = PyList_GET_SIZE(__pyx_v_parts); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2653, __pyx_L1_error)
  __pyx_t_1 = ((__pyx_t_14 == 1) != 0);
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2654
 * 
 *         if len(parts) == 1:
 *             result = parts[0]             # <<<<<<<<<<<<<<
 *         else:
 *             result = Expression("Plus", *parts)
 */
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_parts, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_result = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "mathics/core/expression.py":2653
 *             parts.append(Expression("Times", self.imag, Symbol("I")))
 * 
 *         if len(parts) == 1:             # <<<<<<<<<<<<<<
 *             result = parts[0]
 *         else:
 */
    goto __pyx_L8;
  }

  /* "mathics/core/expression.py":2656
 *             result = parts[0]
 *         else:
 *             result = Expression("Plus", *parts)             # <<<<<<<<<<<<<<
 * 
 *         return Expression("HoldForm", result).do_format(evaluation, form)
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PySequence_Tuple(__pyx_v_parts); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PyNumber_Add(__pyx_tuple__79, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_result = __pyx_t_8;
    __pyx_t_8 = 0;
  }
  __pyx_L8:;

  /* "mathics/core/expression.py":2658
 *             result = Expression("Plus", *parts)
 * 
 *         return Expression("HoldForm", result).do_format(evaluation, form)             # <<<<<<<<<<<<<<
 * 
 *     def default_format(self, evaluation, form) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  __pyx_t_10 = 0;
  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_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_HoldForm, __pyx_v_result};
    __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2658, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_HoldForm, __pyx_v_result};
    __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2658, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2658, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_HoldForm);
    __Pyx_GIVEREF(__pyx_n_u_HoldForm);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_10, __pyx_n_u_HoldForm);
    __Pyx_INCREF(__pyx_v_result);
    __Pyx_GIVEREF(__pyx_v_result);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_10, __pyx_v_result);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2658, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_do_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_evaluation, __pyx_v_form};
    __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2658, __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[3] = {__pyx_t_6, __pyx_v_evaluation, __pyx_v_form};
    __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2658, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_8);
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2658, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_10, __pyx_v_evaluation);
    __Pyx_INCREF(__pyx_v_form);
    __Pyx_GIVEREF(__pyx_v_form);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_10, __pyx_v_form);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2658, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2639
 *         return mpmath.mpc(self.real.to_mpmath(), self.imag.to_mpmath())
 * 
 *     def do_format(self, evaluation, form) -> "Expression":             # <<<<<<<<<<<<<<
 *         if form == "System`FullForm":
 *             return Expression(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.core.expression.Complex.do_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_parts);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2660
 *         return Expression("HoldForm", result).do_format(evaluation, form)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "Complex[%s, %s]" % (
 *             self.real.default_format(evaluation, form),
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_15default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_15default_format = {"default_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_15default_format, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_15default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 1); __PYX_ERR(0, 2660, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 2); __PYX_ERR(0, 2660, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_format") < 0)) __PYX_ERR(0, 2660, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2660, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_14default_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_14default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_form) {
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("default_format", 0);

  /* "mathics/core/expression.py":2661
 * 
 *     def default_format(self, evaluation, form) -> str:
 *         return "Complex[%s, %s]" % (             # <<<<<<<<<<<<<<
 *             self.real.default_format(evaluation, form),
 *             self.imag.default_format(evaluation, form),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 127;
  __Pyx_INCREF(__pyx_kp_u_Complex_2);
  __pyx_t_2 += 8;
  __Pyx_GIVEREF(__pyx_kp_u_Complex_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Complex_2);

  /* "mathics/core/expression.py":2662
 *     def default_format(self, evaluation, form) -> str:
 *         return "Complex[%s, %s]" % (
 *             self.real.default_format(evaluation, form),             # <<<<<<<<<<<<<<
 *             self.imag.default_format(evaluation, form),
 *         )
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_default_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_evaluation, __pyx_v_form};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2662, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_evaluation, __pyx_v_form};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2662, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_evaluation);
    __Pyx_INCREF(__pyx_v_form);
    __Pyx_GIVEREF(__pyx_v_form);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_form);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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__34);
  __pyx_t_2 += 2;
  __Pyx_GIVEREF(__pyx_kp_u__34);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__34);

  /* "mathics/core/expression.py":2663
 *         return "Complex[%s, %s]" % (
 *             self.real.default_format(evaluation, form),
 *             self.imag.default_format(evaluation, form),             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_default_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_evaluation, __pyx_v_form};
    __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2663, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_evaluation, __pyx_v_form};
    __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2663, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_evaluation);
    __Pyx_INCREF(__pyx_v_form);
    __Pyx_GIVEREF(__pyx_v_form);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_form);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2663, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_6), __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_3;
  __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_8);
  __pyx_t_8 = 0;
  __Pyx_INCREF(__pyx_kp_u__35);
  __pyx_t_2 += 1;
  __Pyx_GIVEREF(__pyx_kp_u__35);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u__35);

  /* "mathics/core/expression.py":2661
 * 
 *     def default_format(self, evaluation, form) -> str:
 *         return "Complex[%s, %s]" % (             # <<<<<<<<<<<<<<
 *             self.real.default_format(evaluation, form),
 *             self.imag.default_format(evaluation, form),
 */
  __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_1, 5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2660
 *         return Expression("HoldForm", result).do_format(evaluation, form)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "Complex[%s, %s]" % (
 *             self.real.default_format(evaluation, form),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.core.expression.Complex.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2666
 *         )
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_17get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_17get_sort_key = {"get_sort_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_17get_sort_key, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_17get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_pattern_sort = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sort_key (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_pattern_sort,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_sort);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_sort_key") < 0)) __PYX_ERR(0, 2666, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_pattern_sort = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_sort_key", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2666, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_16get_sort_key(__pyx_self, __pyx_v_self, __pyx_v_pattern_sort);

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

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

  /* "mathics/core/expression.py":2667
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_sort); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2667, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2668
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:
 *             return super().get_sort_key(True)             # <<<<<<<<<<<<<<
 *         else:
 *             return [0, 0, self.real.get_sort_key()[2], self.imag.get_sort_key()[2], 1]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_CyFunction_GetClassObj(__pyx_self);
    if (!__pyx_t_3) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 2668, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2667
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         else:
 */
  }

  /* "mathics/core/expression.py":2670
 *             return super().get_sort_key(True)
 *         else:
 *             return [0, 0, self.real.get_sort_key()[2], self.imag.get_sort_key()[2], 1]             # <<<<<<<<<<<<<<
 * 
 *     def sameQ(self, other) -> bool:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, 2670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__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_2)) __PYX_ERR(0, 2670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_2, 3, __pyx_t_5);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_2, 4, __pyx_int_1);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2666
 *         )
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

  /* 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("mathics.core.expression.Complex.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2672
 *             return [0, 0, self.real.get_sort_key()[2], self.imag.get_sort_key()[2], 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return (
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_19sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_7Complex_18sameQ[] = "Mathics SameQ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_19sameQ = {"sameQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_19sameQ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_7Complex_18sameQ};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_19sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sameQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, 1); __PYX_ERR(0, 2672, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sameQ") < 0)) __PYX_ERR(0, 2672, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2672, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_18sameQ(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":2674
 *     def sameQ(self, other) -> bool:
 *         """Mathics SameQ"""
 *         return (             # <<<<<<<<<<<<<<
 *             isinstance(other, Complex)
 *             and self.real == other.real
 */
  __Pyx_XDECREF(__pyx_r);

  /* "mathics/core/expression.py":2675
 *         """Mathics SameQ"""
 *         return (
 *             isinstance(other, Complex)             # <<<<<<<<<<<<<<
 *             and self.real == other.real
 *             and self.imag == other.imag
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Complex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_other, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2675, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":2676
 *         return (
 *             isinstance(other, Complex)
 *             and self.real == other.real             # <<<<<<<<<<<<<<
 *             and self.imag == other.imag
 *         )
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2676, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2676, __pyx_L1_error)
  if (__pyx_t_3) {
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":2677
 *             isinstance(other, Complex)
 *             and self.real == other.real
 *             and self.imag == other.imag             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2677, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2672
 *             return [0, 0, self.real.get_sort_key()[2], self.imag.get_sort_key()[2], 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return (
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.Complex.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2680
 *         )
 * 
 *     def evaluate(self, evaluation) -> "Complex":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_21evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_21evaluate = {"evaluate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_21evaluate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_21evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); __PYX_ERR(0, 2680, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) __PYX_ERR(0, 2680, __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_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2680, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_20evaluate(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_20evaluate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_evaluation) {
  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("evaluate", 0);

  /* "mathics/core/expression.py":2681
 * 
 *     def evaluate(self, evaluation) -> "Complex":
 *         evaluation.check_stopped()             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_check_stopped); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2681, __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, 2681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2682
 *     def evaluate(self, evaluation) -> "Complex":
 *         evaluation.check_stopped()
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def round(self, d=None) -> "Complex":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2680
 *         )
 * 
 *     def evaluate(self, evaluation) -> "Complex":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Complex.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2684
 *         return self
 * 
 *     def round(self, d=None) -> "Complex":             # <<<<<<<<<<<<<<
 *         real = self.real.round(d)
 *         imag = self.imag.round(d)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_23round(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_23round = {"round", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_23round, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_23round(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_d = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("round (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_d,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "round") < 0)) __PYX_ERR(0, 2684, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("round", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2684, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_22round(__pyx_self, __pyx_v_self, __pyx_v_d);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_22round(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_v_real = NULL;
  PyObject *__pyx_v_imag = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("round", 0);

  /* "mathics/core/expression.py":2685
 * 
 *     def round(self, d=None) -> "Complex":
 *         real = self.real.round(d)             # <<<<<<<<<<<<<<
 *         imag = self.imag.round(d)
 *         return Complex(real, imag)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_round); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_d) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_d);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_real = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2686
 *     def round(self, d=None) -> "Complex":
 *         real = self.real.round(d)
 *         imag = self.imag.round(d)             # <<<<<<<<<<<<<<
 *         return Complex(real, imag)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_round); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2686, __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_d) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_d);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_imag = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2687
 *         real = self.real.round(d)
 *         imag = self.imag.round(d)
 *         return Complex(real, imag)             # <<<<<<<<<<<<<<
 * 
 *     def is_machine_precision(self) -> bool:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Complex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2687, __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_real, __pyx_v_imag};
    __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, 2687, __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_real, __pyx_v_imag};
    __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, 2687, __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, 2687, __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_real);
    __Pyx_GIVEREF(__pyx_v_real);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_real);
    __Pyx_INCREF(__pyx_v_imag);
    __Pyx_GIVEREF(__pyx_v_imag);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_imag);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2687, __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;

  /* "mathics/core/expression.py":2684
 *         return self
 * 
 *     def round(self, d=None) -> "Complex":             # <<<<<<<<<<<<<<
 *         real = self.real.round(d)
 *         imag = self.imag.round(d)
 */

  /* 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("mathics.core.expression.Complex.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_real);
  __Pyx_XDECREF(__pyx_v_imag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2689
 *         return Complex(real, imag)
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         if self.real.is_machine_precision() or self.imag.is_machine_precision():
 *             return True
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_25is_machine_precision(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_25is_machine_precision = {"is_machine_precision", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Complex_25is_machine_precision, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_25is_machine_precision(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_machine_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_24is_machine_precision(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2690
 * 
 *     def is_machine_precision(self) -> bool:
 *         if self.real.is_machine_precision() or self.imag.is_machine_precision():             # <<<<<<<<<<<<<<
 *             return True
 *         return False
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_is_machine_precision); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2690, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_5) {
  } else {
    __pyx_t_1 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_is_machine_precision); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, 2690, __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 < 0)) __PYX_ERR(0, 2690, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2691
 *     def is_machine_precision(self) -> bool:
 *         if self.real.is_machine_precision() or self.imag.is_machine_precision():
 *             return True             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2690
 * 
 *     def is_machine_precision(self) -> bool:
 *         if self.real.is_machine_precision() or self.imag.is_machine_precision():             # <<<<<<<<<<<<<<
 *             return True
 *         return False
 */
  }

  /* "mathics/core/expression.py":2692
 *         if self.real.is_machine_precision() or self.imag.is_machine_precision():
 *             return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def get_float_value(self, permit_complex=False) -> typing.Optional[complex]:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2689
 *         return Complex(real, imag)
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         if self.real.is_machine_precision() or self.imag.is_machine_precision():
 *             return True
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.Complex.is_machine_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2694
 *         return False
 * 
 *     def get_float_value(self, permit_complex=False) -> typing.Optional[complex]:             # <<<<<<<<<<<<<<
 *         if permit_complex:
 *             real = self.real.get_float_value()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_27get_float_value(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_27get_float_value = {"get_float_value", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_27get_float_value, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_27get_float_value(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_permit_complex = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_float_value (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_permit_complex,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_permit_complex);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_float_value") < 0)) __PYX_ERR(0, 2694, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_permit_complex = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_float_value", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2694, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.get_float_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_26get_float_value(__pyx_self, __pyx_v_self, __pyx_v_permit_complex);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_26get_float_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_permit_complex) {
  PyObject *__pyx_v_real = NULL;
  PyObject *__pyx_v_imag = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_float_value", 0);

  /* "mathics/core/expression.py":2695
 * 
 *     def get_float_value(self, permit_complex=False) -> typing.Optional[complex]:
 *         if permit_complex:             # <<<<<<<<<<<<<<
 *             real = self.real.get_float_value()
 *             imag = self.imag.get_float_value()
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_permit_complex); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2695, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2696
 *     def get_float_value(self, permit_complex=False) -> typing.Optional[complex]:
 *         if permit_complex:
 *             real = self.real.get_float_value()             # <<<<<<<<<<<<<<
 *             imag = self.imag.get_float_value()
 *             if real is not None and imag is not None:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_float_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2696, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_real = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":2697
 *         if permit_complex:
 *             real = self.real.get_float_value()
 *             imag = self.imag.get_float_value()             # <<<<<<<<<<<<<<
 *             if real is not None and imag is not None:
 *                 return complex(real, imag)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_float_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, 2697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_imag = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":2698
 *             real = self.real.get_float_value()
 *             imag = self.imag.get_float_value()
 *             if real is not None and imag is not None:             # <<<<<<<<<<<<<<
 *                 return complex(real, imag)
 *         else:
 */
    __pyx_t_5 = (__pyx_v_real != Py_None);
    __pyx_t_6 = (__pyx_t_5 != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_v_imag != Py_None);
    __pyx_t_5 = (__pyx_t_6 != 0);
    __pyx_t_1 = __pyx_t_5;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":2699
 *             imag = self.imag.get_float_value()
 *             if real is not None and imag is not None:
 *                 return complex(real, imag)             # <<<<<<<<<<<<<<
 *         else:
 *             return None
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_real);
      __Pyx_GIVEREF(__pyx_v_real);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_real);
      __Pyx_INCREF(__pyx_v_imag);
      __Pyx_GIVEREF(__pyx_v_imag);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_imag);
      __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2698
 *             real = self.real.get_float_value()
 *             imag = self.imag.get_float_value()
 *             if real is not None and imag is not None:             # <<<<<<<<<<<<<<
 *                 return complex(real, imag)
 *         else:
 */
    }

    /* "mathics/core/expression.py":2695
 * 
 *     def get_float_value(self, permit_complex=False) -> typing.Optional[complex]:
 *         if permit_complex:             # <<<<<<<<<<<<<<
 *             real = self.real.get_float_value()
 *             imag = self.imag.get_float_value()
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":2701
 *                 return complex(real, imag)
 *         else:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def get_precision(self) -> typing.Optional[int]:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":2694
 *         return False
 * 
 *     def get_float_value(self, permit_complex=False) -> typing.Optional[complex]:             # <<<<<<<<<<<<<<
 *         if permit_complex:
 *             real = self.real.get_float_value()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.Complex.get_float_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_real);
  __Pyx_XDECREF(__pyx_v_imag);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2703
 *             return None
 * 
 *     def get_precision(self) -> typing.Optional[int]:             # <<<<<<<<<<<<<<
 *         real_prec = self.real.get_precision()
 *         imag_prec = self.imag.get_precision()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_29get_precision(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_29get_precision = {"get_precision", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Complex_29get_precision, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_29get_precision(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_28get_precision(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_28get_precision(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_v_real_prec = NULL;
  PyObject *__pyx_v_imag_prec = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_precision", 0);

  /* "mathics/core/expression.py":2704
 * 
 *     def get_precision(self) -> typing.Optional[int]:
 *         real_prec = self.real.get_precision()             # <<<<<<<<<<<<<<
 *         imag_prec = self.imag.get_precision()
 *         if imag_prec is None or real_prec is None:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_real_prec = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2705
 *     def get_precision(self) -> typing.Optional[int]:
 *         real_prec = self.real.get_precision()
 *         imag_prec = self.imag.get_precision()             # <<<<<<<<<<<<<<
 *         if imag_prec is None or real_prec is None:
 *             return None
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2705, __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, 2705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_imag_prec = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2706
 *         real_prec = self.real.get_precision()
 *         imag_prec = self.imag.get_precision()
 *         if imag_prec is None or real_prec is None:             # <<<<<<<<<<<<<<
 *             return None
 *         return min(real_prec, imag_prec)
 */
  __pyx_t_5 = (__pyx_v_imag_prec == Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_real_prec == Py_None);
  __pyx_t_5 = (__pyx_t_6 != 0);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":2707
 *         imag_prec = self.imag.get_precision()
 *         if imag_prec is None or real_prec is None:
 *             return None             # <<<<<<<<<<<<<<
 *         return min(real_prec, imag_prec)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/core/expression.py":2706
 *         real_prec = self.real.get_precision()
 *         imag_prec = self.imag.get_precision()
 *         if imag_prec is None or real_prec is None:             # <<<<<<<<<<<<<<
 *             return None
 *         return min(real_prec, imag_prec)
 */
  }

  /* "mathics/core/expression.py":2708
 *         if imag_prec is None or real_prec is None:
 *             return None
 *         return min(real_prec, imag_prec)             # <<<<<<<<<<<<<<
 * 
 *     def do_copy(self) -> "Complex":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_imag_prec);
  __pyx_t_1 = __pyx_v_imag_prec;
  __Pyx_INCREF(__pyx_v_real_prec);
  __pyx_t_2 = __pyx_v_real_prec;
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2708, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2708, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_4) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = __pyx_t_2;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2703
 *             return None
 * 
 *     def get_precision(self) -> typing.Optional[int]:             # <<<<<<<<<<<<<<
 *         real_prec = self.real.get_precision()
 *         imag_prec = self.imag.get_precision()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.Complex.get_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_real_prec);
  __Pyx_XDECREF(__pyx_v_imag_prec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2710
 *         return min(real_prec, imag_prec)
 * 
 *     def do_copy(self) -> "Complex":             # <<<<<<<<<<<<<<
 *         return Complex(self.real.do_copy(), self.imag.do_copy())
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_31do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_31do_copy = {"do_copy", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Complex_31do_copy, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_31do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_30do_copy(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2711
 * 
 *     def do_copy(self) -> "Complex":
 *         return Complex(self.real.do_copy(), self.imag.do_copy())             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Complex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_do_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_3 = (__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_3)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_do_copy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2711, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2711, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2710
 *         return min(real_prec, imag_prec)
 * 
 *     def do_copy(self) -> "Complex":             # <<<<<<<<<<<<<<
 *         return Complex(self.real.do_copy(), self.imag.do_copy())
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.Complex.do_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2713
 *         return Complex(self.real.do_copy(), self.imag.do_copy())
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Complex", self.real, self.imag))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_33__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_33__hash__ = {"__hash__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Complex_33__hash__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_33__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_32__hash__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2714
 * 
 *     def __hash__(self):
 *         return hash(("Complex", self.real, self.imag))             # <<<<<<<<<<<<<<
 * 
 *     def user_hash(self, update) -> None:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_u_Complex);
  __Pyx_GIVEREF(__pyx_n_u_Complex);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_Complex);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_4 = PyObject_Hash(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_hash_t)-1))) __PYX_ERR(0, 2714, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_FromHash_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2713
 *         return Complex(self.real.do_copy(), self.imag.do_copy())
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Complex", self.real, self.imag))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Complex.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2716
 *         return hash(("Complex", self.real, self.imag))
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(b"System`Complex>")
 *         update(self.real)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_35user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_35user_hash = {"user_hash", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_35user_hash, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_35user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_update = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("user_hash (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_update,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_update)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, 1); __PYX_ERR(0, 2716, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "user_hash") < 0)) __PYX_ERR(0, 2716, __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_update = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2716, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_34user_hash(__pyx_self, __pyx_v_self, __pyx_v_update);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_7Complex_34user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update) {
  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("user_hash", 0);

  /* "mathics/core/expression.py":2717
 * 
 *     def user_hash(self, update) -> None:
 *         update(b"System`Complex>")             # <<<<<<<<<<<<<<
 *         update(self.real)
 *         update(self.imag)
 */
  __Pyx_INCREF(__pyx_v_update);
  __pyx_t_2 = __pyx_v_update; __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_b_System_Complex) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_b_System_Complex);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2718
 *     def user_hash(self, update) -> None:
 *         update(b"System`Complex>")
 *         update(self.real)             # <<<<<<<<<<<<<<
 *         update(self.imag)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_update);
  __pyx_t_3 = __pyx_v_update; __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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2719
 *         update(b"System`Complex>")
 *         update(self.real)
 *         update(self.imag)             # <<<<<<<<<<<<<<
 * 
 *     def __eq__(self, other) -> bool:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_update);
  __pyx_t_2 = __pyx_v_update; __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2716
 *         return hash(("Complex", self.real, self.imag))
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(b"System`Complex>")
 *         update(self.real)
 */

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

/* "mathics/core/expression.py":2721
 *         update(self.imag)
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         if isinstance(other, Complex):
 *             return self.real == other.real and self.imag == other.imag
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_37__eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_37__eq__ = {"__eq__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_7Complex_37__eq__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_37__eq__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, 1); __PYX_ERR(0, 2721, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__eq__") < 0)) __PYX_ERR(0, 2721, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2721, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Complex.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_36__eq__(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":2722
 * 
 *     def __eq__(self, other) -> bool:
 *         if isinstance(other, Complex):             # <<<<<<<<<<<<<<
 *             return self.real == other.real and self.imag == other.imag
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Complex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2722, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_other, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 2722, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":2723
 *     def __eq__(self, other) -> bool:
 *         if isinstance(other, Complex):
 *             return self.real == other.real and self.imag == other.imag             # <<<<<<<<<<<<<<
 *         else:
 *             return self.get_sort_key() == other.get_sort_key()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_real); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2723, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2723, __pyx_L1_error)
    if (__pyx_t_3) {
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_1 = __pyx_t_6;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_imag); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2723, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_L4_bool_binop_done:;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2722
 * 
 *     def __eq__(self, other) -> bool:
 *         if isinstance(other, Complex):             # <<<<<<<<<<<<<<
 *             return self.real == other.real and self.imag == other.imag
 *         else:
 */
  }

  /* "mathics/core/expression.py":2725
 *             return self.real == other.real and self.imag == other.imag
 *         else:
 *             return self.get_sort_key() == other.get_sort_key()             # <<<<<<<<<<<<<<
 * 
 *     def __getnewargs__(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2725, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2725, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2725, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2725, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2725, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2721
 *         update(self.imag)
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         if isinstance(other, Complex):
 *             return self.real == other.real and self.imag == other.imag
 */

  /* 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("mathics.core.expression.Complex.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2727
 *             return self.get_sort_key() == other.get_sort_key()
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.real, self.imag)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_39__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_39__getnewargs__ = {"__getnewargs__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Complex_39__getnewargs__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_39__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getnewargs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_38__getnewargs__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2728
 * 
 *     def __getnewargs__(self):
 *         return (self.real, self.imag)             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2728, __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;

  /* "mathics/core/expression.py":2727
 *             return self.get_sort_key() == other.get_sort_key()
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.real, self.imag)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Complex.__getnewargs__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2730
 *         return (self.real, self.imag)
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return Complex(-self.real, -self.imag)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_41__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_41__neg__ = {"__neg__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Complex_41__neg__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_41__neg__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_40__neg__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2731
 * 
 *     def __neg__(self):
 *         return Complex(-self.real, -self.imag)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Complex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2731, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __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_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2731, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2730
 *         return (self.real, self.imag)
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return Complex(-self.real, -self.imag)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.Complex.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2734
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.real.is_zero and self.imag.is_zero
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_43is_zero(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_43is_zero = {"is_zero", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Complex_43is_zero, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_43is_zero(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_zero (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_42is_zero(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2735
 *     @property
 *     def is_zero(self) -> bool:
 *         return self.real.is_zero and self.imag.is_zero             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_zero); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2735, __pyx_L1_error)
  if (__pyx_t_4) {
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_is_zero); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2734
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.real.is_zero and self.imag.is_zero
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.Complex.is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2738
 * 
 *     @property
 *     def is_approx_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         real_zero = (
 *             self.real.is_approx_zero
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_45is_approx_zero(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_7Complex_45is_approx_zero = {"is_approx_zero", (PyCFunction)__pyx_pw_7mathics_4core_10expression_7Complex_45is_approx_zero, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_7Complex_45is_approx_zero(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_approx_zero (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_7Complex_44is_approx_zero(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2741
 *         real_zero = (
 *             self.real.is_approx_zero
 *             if hasattr(self.real, "is_approx_zero")             # <<<<<<<<<<<<<<
 *             else self.real.is_zero
 *         )
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_u_is_approx_zero); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2741, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((__pyx_t_3 != 0)) {

    /* "mathics/core/expression.py":2740
 *     def is_approx_zero(self) -> bool:
 *         real_zero = (
 *             self.real.is_approx_zero             # <<<<<<<<<<<<<<
 *             if hasattr(self.real, "is_approx_zero")
 *             else self.real.is_zero
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_approx_zero); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {

    /* "mathics/core/expression.py":2742
 *             self.real.is_approx_zero
 *             if hasattr(self.real, "is_approx_zero")
 *             else self.real.is_zero             # <<<<<<<<<<<<<<
 *         )
 *         imag_zero = (
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_real); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_is_zero); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2742, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_v_real_zero = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2746
 *         imag_zero = (
 *             self.imag.is_approx_zero
 *             if hasattr(self.imag, "is_approx_zero")             # <<<<<<<<<<<<<<
 *             else self.imag.is_zero
 *         )
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_HasAttr(__pyx_t_2, __pyx_n_u_is_approx_zero); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2746, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((__pyx_t_3 != 0)) {

    /* "mathics/core/expression.py":2745
 *         )
 *         imag_zero = (
 *             self.imag.is_approx_zero             # <<<<<<<<<<<<<<
 *             if hasattr(self.imag, "is_approx_zero")
 *             else self.imag.is_zero
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2745, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_is_approx_zero); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2745, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {

    /* "mathics/core/expression.py":2747
 *             self.imag.is_approx_zero
 *             if hasattr(self.imag, "is_approx_zero")
 *             else self.imag.is_zero             # <<<<<<<<<<<<<<
 *         )
 *         return real_zero and imag_zero
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2747, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_is_zero); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2747, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_v_imag_zero = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2749
 *             else self.imag.is_zero
 *         )
 *         return real_zero and imag_zero             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_real_zero); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2749, __pyx_L1_error)
  if (__pyx_t_3) {
  } else {
    __Pyx_INCREF(__pyx_v_real_zero);
    __pyx_t_1 = __pyx_v_real_zero;
    goto __pyx_L3_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_v_imag_zero);
  __pyx_t_1 = __pyx_v_imag_zero;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2738
 * 
 *     @property
 *     def is_approx_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         real_zero = (
 *             self.real.is_approx_zero
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.Complex.is_approx_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_real_zero);
  __Pyx_XDECREF(__pyx_v_imag_zero);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2752
 * 
 * 
 * def encode_mathml(text: str) -> str:             # <<<<<<<<<<<<<<
 *     text = text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
 *     text = text.replace('"', "&quot;").replace(" ", "&nbsp;")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_21encode_mathml(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_21encode_mathml = {"encode_mathml", (PyCFunction)__pyx_pw_7mathics_4core_10expression_21encode_mathml, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_21encode_mathml(PyObject *__pyx_self, PyObject *__pyx_v_text) {
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("encode_mathml (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_text), (&PyUnicode_Type), 1, "text", 1))) __PYX_ERR(0, 2752, __pyx_L1_error)
  __pyx_r = __pyx_pf_7mathics_4core_10expression_20encode_mathml(__pyx_self, ((PyObject*)__pyx_v_text));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_20encode_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text) {
  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("encode_mathml", 0);
  __Pyx_INCREF(__pyx_v_text);

  /* "mathics/core/expression.py":2753
 * 
 * def encode_mathml(text: str) -> str:
 *     text = text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")             # <<<<<<<<<<<<<<
 *     text = text.replace('"', "&quot;").replace(" ", "&nbsp;")
 *     text = text.replace("\n", '<mspace linebreak="newline" />')
 */
  if (unlikely(__pyx_v_text == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "replace");
    __PYX_ERR(0, 2753, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_Replace(__pyx_v_text, __pyx_kp_u__80, __pyx_kp_u_amp, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_Replace(((PyObject*)__pyx_t_1), __pyx_kp_u__70, __pyx_kp_u_lt, -1L); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyUnicode_Replace(((PyObject*)__pyx_t_2), __pyx_kp_u__69, __pyx_kp_u_gt, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_text, ((PyObject*)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2754
 * def encode_mathml(text: str) -> str:
 *     text = text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
 *     text = text.replace('"', "&quot;").replace(" ", "&nbsp;")             # <<<<<<<<<<<<<<
 *     text = text.replace("\n", '<mspace linebreak="newline" />')
 *     return text
 */
  if (unlikely(__pyx_v_text == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "replace");
    __PYX_ERR(0, 2754, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_Replace(__pyx_v_text, __pyx_kp_u__81, __pyx_kp_u_quot, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyUnicode_Replace(((PyObject*)__pyx_t_1), __pyx_kp_u__53, __pyx_kp_u_nbsp, -1L); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_text, ((PyObject*)__pyx_t_2));
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2755
 *     text = text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
 *     text = text.replace('"', "&quot;").replace(" ", "&nbsp;")
 *     text = text.replace("\n", '<mspace linebreak="newline" />')             # <<<<<<<<<<<<<<
 *     return text
 * 
 */
  if (unlikely(__pyx_v_text == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "replace");
    __PYX_ERR(0, 2755, __pyx_L1_error)
  }
  __pyx_t_2 = PyUnicode_Replace(__pyx_v_text, __pyx_kp_u__82, __pyx_kp_u_mspace_linebreak_newline, -1L); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_text, ((PyObject*)__pyx_t_2));
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2756
 *     text = text.replace('"', "&quot;").replace(" ", "&nbsp;")
 *     text = text.replace("\n", '<mspace linebreak="newline" />')
 *     return text             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_text);
  __pyx_r = __pyx_v_text;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2752
 * 
 * 
 * def encode_mathml(text: str) -> str:             # <<<<<<<<<<<<<<
 *     text = text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
 *     text = text.replace('"', "&quot;").replace(" ", "&nbsp;")
 */

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

/* "mathics/core/expression.py":2786
 * 
 * 
 * def encode_tex(text: str, in_text=False) -> str:             # <<<<<<<<<<<<<<
 *     def replace(match):
 *         c = match.group(1)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_23encode_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_23encode_tex = {"encode_tex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_23encode_tex, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_23encode_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_text = 0;
  PyObject *__pyx_v_in_text = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("encode_tex (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_text,&__pyx_n_s_in_text,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_text)) != 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_in_text);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_tex") < 0)) __PYX_ERR(0, 2786, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_text = ((PyObject*)values[0]);
    __pyx_v_in_text = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("encode_tex", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2786, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.encode_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_text), (&PyUnicode_Type), 1, "text", 1))) __PYX_ERR(0, 2786, __pyx_L1_error)
  __pyx_r = __pyx_pf_7mathics_4core_10expression_22encode_tex(__pyx_self, __pyx_v_text, __pyx_v_in_text);

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

/* "mathics/core/expression.py":2787
 * 
 * def encode_tex(text: str, in_text=False) -> str:
 *     def replace(match):             # <<<<<<<<<<<<<<
 *         c = match.group(1)
 *         repl = TEX_TEXT_REPLACE if in_text else TEX_REPLACE
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_10encode_tex_1replace(PyObject *__pyx_self, PyObject *__pyx_v_match); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_10encode_tex_1replace = {"replace", (PyCFunction)__pyx_pw_7mathics_4core_10expression_10encode_tex_1replace, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_10encode_tex_1replace(PyObject *__pyx_self, PyObject *__pyx_v_match) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("replace (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_10encode_tex_replace(__pyx_self, ((PyObject *)__pyx_v_match));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_10encode_tex_replace(PyObject *__pyx_self, PyObject *__pyx_v_match) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *__pyx_cur_scope;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *__pyx_outer_scope;
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_repl = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("replace", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/core/expression.py":2788
 * def encode_tex(text: str, in_text=False) -> str:
 *     def replace(match):
 *         c = match.group(1)             # <<<<<<<<<<<<<<
 *         repl = TEX_TEXT_REPLACE if in_text else TEX_REPLACE
 *         # return TEX_REPLACE[c]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_match, __pyx_n_s_group); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_c = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2789
 *     def replace(match):
 *         c = match.group(1)
 *         repl = TEX_TEXT_REPLACE if in_text else TEX_REPLACE             # <<<<<<<<<<<<<<
 *         # return TEX_REPLACE[c]
 *         return repl.get(c, c)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_in_text)) { __Pyx_RaiseClosureNameError("in_text"); __PYX_ERR(0, 2789, __pyx_L1_error) }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_in_text); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2789, __pyx_L1_error)
  if (__pyx_t_4) {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_TEX_TEXT_REPLACE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_TEX_REPLACE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_v_repl = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2791
 *         repl = TEX_TEXT_REPLACE if in_text else TEX_REPLACE
 *         # return TEX_REPLACE[c]
 *         return repl.get(c, c)             # <<<<<<<<<<<<<<
 * 
 *     text = TEX_REPLACE_RE.sub(replace, text)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_repl, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_5 = 0;
  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_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_c, __pyx_v_c};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2791, __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_c, __pyx_v_c};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2791, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2791, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_c);
    __Pyx_GIVEREF(__pyx_v_c);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_c);
    __Pyx_INCREF(__pyx_v_c);
    __Pyx_GIVEREF(__pyx_v_c);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_c);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2791, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2787
 * 
 * def encode_tex(text: str, in_text=False) -> str:
 *     def replace(match):             # <<<<<<<<<<<<<<
 *         c = match.group(1)
 *         repl = TEX_TEXT_REPLACE if in_text else TEX_REPLACE
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.encode_tex.replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_repl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2786
 * 
 * 
 * def encode_tex(text: str, in_text=False) -> str:             # <<<<<<<<<<<<<<
 *     def replace(match):
 *         c = match.group(1)
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_22encode_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text, PyObject *__pyx_v_in_text) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *__pyx_cur_scope;
  PyObject *__pyx_v_replace = 0;
  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("encode_tex", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2786, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_in_text = __pyx_v_in_text;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_in_text);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_in_text);
  __Pyx_INCREF(__pyx_v_text);

  /* "mathics/core/expression.py":2787
 * 
 * def encode_tex(text: str, in_text=False) -> str:
 *     def replace(match):             # <<<<<<<<<<<<<<
 *         c = match.group(1)
 *         repl = TEX_TEXT_REPLACE if in_text else TEX_REPLACE
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10encode_tex_1replace, 0, __pyx_n_s_encode_tex_locals_replace, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_replace = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2793
 *         return repl.get(c, c)
 * 
 *     text = TEX_REPLACE_RE.sub(replace, text)             # <<<<<<<<<<<<<<
 *     text = text.replace("\n", "\\newline\n")
 *     return text
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_TEX_REPLACE_RE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sub); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_replace, __pyx_v_text};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2793, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_replace, __pyx_v_text};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2793, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2793, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_replace);
    __Pyx_GIVEREF(__pyx_v_replace);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_replace);
    __Pyx_INCREF(__pyx_v_text);
    __Pyx_GIVEREF(__pyx_v_text);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_text);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2793, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2793, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_text, ((PyObject*)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2794
 * 
 *     text = TEX_REPLACE_RE.sub(replace, text)
 *     text = text.replace("\n", "\\newline\n")             # <<<<<<<<<<<<<<
 *     return text
 * 
 */
  if (unlikely(__pyx_v_text == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "replace");
    __PYX_ERR(0, 2794, __pyx_L1_error)
  }
  __pyx_t_1 = PyUnicode_Replace(__pyx_v_text, __pyx_kp_u__82, __pyx_kp_u_newline, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_text, ((PyObject*)__pyx_t_1));
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2795
 *     text = TEX_REPLACE_RE.sub(replace, text)
 *     text = text.replace("\n", "\\newline\n")
 *     return text             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_text);
  __pyx_r = __pyx_v_text;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2786
 * 
 * 
 * def encode_tex(text: str, in_text=False) -> str:             # <<<<<<<<<<<<<<
 *     def replace(match):
 *         c = match.group(1)
 */

  /* 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("mathics.core.expression.encode_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_replace);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2823
 *     value: str
 * 
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         self.value = str(value)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, 1); __PYX_ERR(0, 2823, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 2823, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_cls = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2823, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.String.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String___new__(__pyx_self, __pyx_v_cls, __pyx_v_value);

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

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

  /* "mathics/core/expression.py":2824
 * 
 *     def __new__(cls, value):
 *         self = super().__new__(cls)             # <<<<<<<<<<<<<<
 *         self.value = str(value)
 *         return self
 */
  __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 2824, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_cls);
  __Pyx_GIVEREF(__pyx_v_cls);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cls);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_cls) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cls);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2825
 *     def __new__(cls, value):
 *         self = super().__new__(cls)
 *         self.value = str(value)             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_t_1) < 0) __PYX_ERR(0, 2825, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2826
 *         self = super().__new__(cls)
 *         self.value = str(value)
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2823
 *     value: str
 * 
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         self.value = str(value)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.String.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2828
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return '"%s"' % self.value
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_3__str__ = {"__str__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6String_3__str__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2829
 * 
 *     def __str__(self) -> str:
 *         return '"%s"' % self.value             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_text(self, show_string_characters=False, **options) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2828
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return '"%s"' % self.value
 * 
 */

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

/* "mathics/core/expression.py":2831
 *         return '"%s"' % self.value
 * 
 *     def boxes_to_text(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_5boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_5boxes_to_text = {"boxes_to_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_5boxes_to_text, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_5boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_show_string_characters = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_text (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_show_string_characters,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_show_string_characters);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_text") < 0)) __PYX_ERR(0, 2831, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_show_string_characters = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_text", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2831, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.String.boxes_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_4boxes_to_text(__pyx_self, __pyx_v_self, __pyx_v_show_string_characters, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6String_4boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_show_string_characters, CYTHON_UNUSED PyObject *__pyx_v_options) {
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("boxes_to_text", 0);

  /* "mathics/core/expression.py":2832
 * 
 *     def boxes_to_text(self, show_string_characters=False, **options) -> str:
 *         value = self.value             # <<<<<<<<<<<<<<
 * 
 *         if (
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_value = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2835
 * 
 *         if (
 *             not show_string_characters             # <<<<<<<<<<<<<<
 *             and value.startswith('"')  # nopep8
 *             and value.endswith('"')
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_show_string_characters); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2835, __pyx_L1_error)
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }

  /* "mathics/core/expression.py":2836
 *         if (
 *             not show_string_characters
 *             and value.startswith('"')  # nopep8             # <<<<<<<<<<<<<<
 *             and value.endswith('"')
 *         ):
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_startswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_u__81) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u__81);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2836, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }

  /* "mathics/core/expression.py":2837
 *             not show_string_characters
 *             and value.startswith('"')  # nopep8
 *             and value.endswith('"')             # <<<<<<<<<<<<<<
 *         ):
 *             value = value[1:-1]
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_endswith); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_u__81) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u__81);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2837, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;

  /* "mathics/core/expression.py":2834
 *         value = self.value
 * 
 *         if (             # <<<<<<<<<<<<<<
 *             not show_string_characters
 *             and value.startswith('"')  # nopep8
 */
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":2839
 *             and value.endswith('"')
 *         ):
 *             value = value[1:-1]             # <<<<<<<<<<<<<<
 * 
 *         return value
 */
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_value, 1, -1L, NULL, NULL, &__pyx_slice__85, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":2834
 *         value = self.value
 * 
 *         if (             # <<<<<<<<<<<<<<
 *             not show_string_characters
 *             and value.startswith('"')  # nopep8
 */
  }

  /* "mathics/core/expression.py":2841
 *             value = value[1:-1]
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_mathml(self, show_string_characters=False, **options) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  if (!(likely(PyUnicode_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 2841, __pyx_L1_error)
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = ((PyObject*)__pyx_v_value);
  goto __pyx_L0;

  /* "mathics/core/expression.py":2831
 *         return '"%s"' % self.value
 * 
 *     def boxes_to_text(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.String.boxes_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2843
 *         return value
 * 
 *     def boxes_to_mathml(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         from mathics.core.parser import is_symbol_name
 *         from mathics.builtin import builtins_by_module
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_7boxes_to_mathml(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_7boxes_to_mathml = {"boxes_to_mathml", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_7boxes_to_mathml, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_7boxes_to_mathml(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_show_string_characters = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_mathml (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_show_string_characters,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_show_string_characters);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_mathml") < 0)) __PYX_ERR(0, 2843, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_show_string_characters = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_mathml", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2843, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.String.boxes_to_mathml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_6boxes_to_mathml(__pyx_self, __pyx_v_self, __pyx_v_show_string_characters, __pyx_v_options);

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

/* "mathics/core/expression.py":2857
 *         text = self.value
 * 
 *         def render(format, string):             # <<<<<<<<<<<<<<
 *             encoded_text = encode_mathml(string)
 *             return format % encoded_text
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_15boxes_to_mathml_1render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_15boxes_to_mathml_1render = {"render", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_15boxes_to_mathml_1render, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_15boxes_to_mathml_1render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_v_string = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_format,&__pyx_n_s_string,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_format)) != 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_string)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 2, 2, 1); __PYX_ERR(0, 2857, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "render") < 0)) __PYX_ERR(0, 2857, __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_format = values[0];
    __pyx_v_string = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("render", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2857, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.String.boxes_to_mathml.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(__pyx_self, __pyx_v_format, __pyx_v_string);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_format, PyObject *__pyx_v_string) {
  PyObject *__pyx_v_encoded_text = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("render", 0);

  /* "mathics/core/expression.py":2858
 * 
 *         def render(format, string):
 *             encoded_text = encode_mathml(string)             # <<<<<<<<<<<<<<
 *             return format % encoded_text
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_mathml); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_string) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_string);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_encoded_text = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2859
 *         def render(format, string):
 *             encoded_text = encode_mathml(string)
 *             return format % encoded_text             # <<<<<<<<<<<<<<
 * 
 *         if text.startswith('"') and text.endswith('"'):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyNumber_Remainder(__pyx_v_format, __pyx_v_encoded_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2857
 *         text = self.value
 * 
 *         def render(format, string):             # <<<<<<<<<<<<<<
 *             encoded_text = encode_mathml(string)
 *             return format % encoded_text
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.String.boxes_to_mathml.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_encoded_text);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2843
 *         return value
 * 
 *     def boxes_to_mathml(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         from mathics.core.parser import is_symbol_name
 *         from mathics.builtin import builtins_by_module
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_6String_6boxes_to_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_show_string_characters, CYTHON_UNUSED PyObject *__pyx_v_options) {
  PyObject *__pyx_v_is_symbol_name = NULL;
  PyObject *__pyx_v_builtins_by_module = NULL;
  PyObject *__pyx_v_operators = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_modname = NULL;
  PyObject *__pyx_v_builtins = NULL;
  PyObject *__pyx_v_builtin = NULL;
  PyObject *__pyx_v_operator = NULL;
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_v_render = 0;
  PyObject *__pyx_v_outtext = NULL;
  PyObject *__pyx_v_line = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("boxes_to_mathml", 0);

  /* "mathics/core/expression.py":2844
 * 
 *     def boxes_to_mathml(self, show_string_characters=False, **options) -> str:
 *         from mathics.core.parser import is_symbol_name             # <<<<<<<<<<<<<<
 *         from mathics.builtin import builtins_by_module
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_is_symbol_name);
  __Pyx_GIVEREF(__pyx_n_s_is_symbol_name);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_is_symbol_name);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_core_parser, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2844, __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_is_symbol_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_is_symbol_name = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2845
 *     def boxes_to_mathml(self, show_string_characters=False, **options) -> str:
 *         from mathics.core.parser import is_symbol_name
 *         from mathics.builtin import builtins_by_module             # <<<<<<<<<<<<<<
 * 
 *         operators = set()
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_builtins_by_module);
  __Pyx_GIVEREF(__pyx_n_s_builtins_by_module);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_builtins_by_module);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_mathics_builtin, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2845, __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_builtins_by_module); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_builtins_by_module = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2847
 *         from mathics.builtin import builtins_by_module
 * 
 *         operators = set()             # <<<<<<<<<<<<<<
 *         for modname, builtins in builtins_by_module.items():
 *             for builtin in builtins:
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_operators = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2848
 * 
 *         operators = set()
 *         for modname, builtins in builtins_by_module.items():             # <<<<<<<<<<<<<<
 *             for builtin in builtins:
 *                 # name = builtin.get_name()
 */
  __pyx_t_3 = 0;
  if (unlikely(__pyx_v_builtins_by_module == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 2848, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_dict_iterator(__pyx_v_builtins_by_module, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_2;
  __pyx_t_2 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_4, &__pyx_t_3, &__pyx_t_2, &__pyx_t_6, NULL, __pyx_t_5);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 2848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_modname, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_builtins, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "mathics/core/expression.py":2849
 *         operators = set()
 *         for modname, builtins in builtins_by_module.items():
 *             for builtin in builtins:             # <<<<<<<<<<<<<<
 *                 # name = builtin.get_name()
 *                 operator = builtin.get_operator_display()
 */
    if (likely(PyList_CheckExact(__pyx_v_builtins)) || PyTuple_CheckExact(__pyx_v_builtins)) {
      __pyx_t_6 = __pyx_v_builtins; __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_builtins); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2849, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2849, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 2849, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2849, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 2849, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2849, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_9(__pyx_t_6);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2849, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_builtin, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":2851
 *             for builtin in builtins:
 *                 # name = builtin.get_name()
 *                 operator = builtin.get_operator_display()             # <<<<<<<<<<<<<<
 *                 if operator is not None:
 *                     operators.add(operator)
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_builtin, __pyx_n_s_get_operator_display); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2851, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_2 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2851, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_operator, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/core/expression.py":2852
 *                 # name = builtin.get_name()
 *                 operator = builtin.get_operator_display()
 *                 if operator is not None:             # <<<<<<<<<<<<<<
 *                     operators.add(operator)
 * 
 */
      __pyx_t_12 = (__pyx_v_operator != Py_None);
      __pyx_t_13 = (__pyx_t_12 != 0);
      if (__pyx_t_13) {

        /* "mathics/core/expression.py":2853
 *                 operator = builtin.get_operator_display()
 *                 if operator is not None:
 *                     operators.add(operator)             # <<<<<<<<<<<<<<
 * 
 *         text = self.value
 */
        __pyx_t_14 = PySet_Add(__pyx_v_operators, __pyx_v_operator); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 2853, __pyx_L1_error)

        /* "mathics/core/expression.py":2852
 *                 # name = builtin.get_name()
 *                 operator = builtin.get_operator_display()
 *                 if operator is not None:             # <<<<<<<<<<<<<<
 *                     operators.add(operator)
 * 
 */
      }

      /* "mathics/core/expression.py":2849
 *         operators = set()
 *         for modname, builtins in builtins_by_module.items():
 *             for builtin in builtins:             # <<<<<<<<<<<<<<
 *                 # name = builtin.get_name()
 *                 operator = builtin.get_operator_display()
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2855
 *                     operators.add(operator)
 * 
 *         text = self.value             # <<<<<<<<<<<<<<
 * 
 *         def render(format, string):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2855, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_text = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2857
 *         text = self.value
 * 
 *         def render(format, string):             # <<<<<<<<<<<<<<
 *             encoded_text = encode_mathml(string)
 *             return format % encoded_text
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_15boxes_to_mathml_1render, 0, __pyx_n_s_String_boxes_to_mathml_locals_re, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_render = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2861
 *             return format % encoded_text
 * 
 *         if text.startswith('"') and text.endswith('"'):             # <<<<<<<<<<<<<<
 *             if show_string_characters:
 *                 return render("<ms>%s</ms>", text[1:-1])
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_text, __pyx_n_s_startswith); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_2, __pyx_kp_u__81) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u__81);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2861, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_12) {
  } else {
    __pyx_t_13 = __pyx_t_12;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_text, __pyx_n_s_endswith); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_2, __pyx_kp_u__81) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u__81);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2861, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_13 = __pyx_t_12;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_13) {

    /* "mathics/core/expression.py":2862
 * 
 *         if text.startswith('"') and text.endswith('"'):
 *             if show_string_characters:             # <<<<<<<<<<<<<<
 *                 return render("<ms>%s</ms>", text[1:-1])
 *             else:
 */
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_show_string_characters); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2862, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2863
 *         if text.startswith('"') and text.endswith('"'):
 *             if show_string_characters:
 *                 return render("<ms>%s</ms>", text[1:-1])             # <<<<<<<<<<<<<<
 *             else:
 *                 outtext = ""
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_text, 1, -1L, NULL, NULL, &__pyx_slice__85, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(__pyx_v_render, __pyx_kp_u_ms_s_ms, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 2863, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2862
 * 
 *         if text.startswith('"') and text.endswith('"'):
 *             if show_string_characters:             # <<<<<<<<<<<<<<
 *                 return render("<ms>%s</ms>", text[1:-1])
 *             else:
 */
    }

    /* "mathics/core/expression.py":2865
 *                 return render("<ms>%s</ms>", text[1:-1])
 *             else:
 *                 outtext = ""             # <<<<<<<<<<<<<<
 *                 for line in text[1:-1].split("\n"):
 *                     outtext += render("<mtext>%s</mtext>", line)
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_kp_u__3);
      __pyx_v_outtext = __pyx_kp_u__3;

      /* "mathics/core/expression.py":2866
 *             else:
 *                 outtext = ""
 *                 for line in text[1:-1].split("\n"):             # <<<<<<<<<<<<<<
 *                     outtext += render("<mtext>%s</mtext>", line)
 *                 return outtext
 */
      __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_text, 1, -1L, NULL, NULL, &__pyx_slice__85, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2866, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2866, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_kp_u__82) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u__82);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2866, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
        __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
        __pyx_t_9 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2866, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2866, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      for (;;) {
        if (likely(!__pyx_t_9)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 2866, __pyx_L1_error)
            #else
            __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2866, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          } else {
            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 2866, __pyx_L1_error)
            #else
            __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2866, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          }
        } else {
          __pyx_t_6 = __pyx_t_9(__pyx_t_2);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 2866, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "mathics/core/expression.py":2867
 *                 outtext = ""
 *                 for line in text[1:-1].split("\n"):
 *                     outtext += render("<mtext>%s</mtext>", line)             # <<<<<<<<<<<<<<
 *                 return outtext
 *         elif text and ("0" <= text[0] <= "9" or text[0] == "."):
 */
        __pyx_t_6 = __pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(__pyx_v_render, __pyx_kp_u_mtext_s_mtext, __pyx_v_line); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2867, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_outtext, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2867, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF_SET(__pyx_v_outtext, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "mathics/core/expression.py":2866
 *             else:
 *                 outtext = ""
 *                 for line in text[1:-1].split("\n"):             # <<<<<<<<<<<<<<
 *                     outtext += render("<mtext>%s</mtext>", line)
 *                 return outtext
 */
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/core/expression.py":2868
 *                 for line in text[1:-1].split("\n"):
 *                     outtext += render("<mtext>%s</mtext>", line)
 *                 return outtext             # <<<<<<<<<<<<<<
 *         elif text and ("0" <= text[0] <= "9" or text[0] == "."):
 *             return render("<mn>%s</mn>", text)
 */
      __Pyx_XDECREF(__pyx_r);
      if (!(likely(PyUnicode_CheckExact(__pyx_v_outtext))||((__pyx_v_outtext) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_outtext)->tp_name), 0))) __PYX_ERR(0, 2868, __pyx_L1_error)
      __Pyx_INCREF(__pyx_v_outtext);
      __pyx_r = ((PyObject*)__pyx_v_outtext);
      goto __pyx_L0;
    }

    /* "mathics/core/expression.py":2861
 *             return format % encoded_text
 * 
 *         if text.startswith('"') and text.endswith('"'):             # <<<<<<<<<<<<<<
 *             if show_string_characters:
 *                 return render("<ms>%s</ms>", text[1:-1])
 */
  }

  /* "mathics/core/expression.py":2869
 *                     outtext += render("<mtext>%s</mtext>", line)
 *                 return outtext
 *         elif text and ("0" <= text[0] <= "9" or text[0] == "."):             # <<<<<<<<<<<<<<
 *             return render("<mn>%s</mn>", text)
 *         else:
 */
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2869, __pyx_L1_error)
  if (__pyx_t_12) {
  } else {
    __pyx_t_13 = __pyx_t_12;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_text, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_RichCompare(__pyx_kp_u_0, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2869, __pyx_L1_error)
  if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_kp_u_9, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2869, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2869, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_12) {
  } else {
    __pyx_t_13 = __pyx_t_12;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_text, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_12 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u__88, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2869, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_13 = __pyx_t_12;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_13) {

    /* "mathics/core/expression.py":2870
 *                 return outtext
 *         elif text and ("0" <= text[0] <= "9" or text[0] == "."):
 *             return render("<mn>%s</mn>", text)             # <<<<<<<<<<<<<<
 *         else:
 *             if text in operators or text in extra_operators:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(__pyx_v_render, __pyx_kp_u_mn_s_mn, __pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2870, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2870, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2869
 *                     outtext += render("<mtext>%s</mtext>", line)
 *                 return outtext
 *         elif text and ("0" <= text[0] <= "9" or text[0] == "."):             # <<<<<<<<<<<<<<
 *             return render("<mn>%s</mn>", text)
 *         else:
 */
  }

  /* "mathics/core/expression.py":2872
 *             return render("<mn>%s</mn>", text)
 *         else:
 *             if text in operators or text in extra_operators:             # <<<<<<<<<<<<<<
 *                 if text == "\u2146":
 *                     return render(
 */
  /*else*/ {
    __pyx_t_12 = (__Pyx_PySet_ContainsTF(__pyx_v_text, __pyx_v_operators, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __pyx_t_15 = (__pyx_t_12 != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_13 = __pyx_t_15;
      goto __pyx_L18_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_extra_operators); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_15 = (__Pyx_PySequence_ContainsTF(__pyx_v_text, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 2872, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = (__pyx_t_15 != 0);
    __pyx_t_13 = __pyx_t_12;
    __pyx_L18_bool_binop_done:;
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2873
 *         else:
 *             if text in operators or text in extra_operators:
 *                 if text == "\u2146":             # <<<<<<<<<<<<<<
 *                     return render(
 *                         '<mo form="prefix" lspace="0.2em" rspace="0">%s</mo>', text
 */
      __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_n_u__89, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2873, __pyx_L1_error)
      if (__pyx_t_13) {

        /* "mathics/core/expression.py":2874
 *             if text in operators or text in extra_operators:
 *                 if text == "\u2146":
 *                     return render(             # <<<<<<<<<<<<<<
 *                         '<mo form="prefix" lspace="0.2em" rspace="0">%s</mo>', text
 *                     )
 */
        __Pyx_XDECREF(__pyx_r);

        /* "mathics/core/expression.py":2875
 *                 if text == "\u2146":
 *                     return render(
 *                         '<mo form="prefix" lspace="0.2em" rspace="0">%s</mo>', text             # <<<<<<<<<<<<<<
 *                     )
 *                 if text == "\u2062":
 */
        __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(__pyx_v_render, __pyx_kp_u_mo_form_prefix_lspace_0_2em_rsp, __pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2874, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);

        /* "mathics/core/expression.py":2874
 *             if text in operators or text in extra_operators:
 *                 if text == "\u2146":
 *                     return render(             # <<<<<<<<<<<<<<
 *                         '<mo form="prefix" lspace="0.2em" rspace="0">%s</mo>', text
 *                     )
 */
        if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2874, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_1);
        __pyx_t_1 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":2873
 *         else:
 *             if text in operators or text in extra_operators:
 *                 if text == "\u2146":             # <<<<<<<<<<<<<<
 *                     return render(
 *                         '<mo form="prefix" lspace="0.2em" rspace="0">%s</mo>', text
 */
      }

      /* "mathics/core/expression.py":2877
 *                         '<mo form="prefix" lspace="0.2em" rspace="0">%s</mo>', text
 *                     )
 *                 if text == "\u2062":             # <<<<<<<<<<<<<<
 *                     return render(
 *                         '<mo form="prefix" lspace="0" rspace="0.2em">%s</mo>', text
 */
      __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__90, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2877, __pyx_L1_error)
      if (__pyx_t_13) {

        /* "mathics/core/expression.py":2878
 *                     )
 *                 if text == "\u2062":
 *                     return render(             # <<<<<<<<<<<<<<
 *                         '<mo form="prefix" lspace="0" rspace="0.2em">%s</mo>', text
 *                     )
 */
        __Pyx_XDECREF(__pyx_r);

        /* "mathics/core/expression.py":2879
 *                 if text == "\u2062":
 *                     return render(
 *                         '<mo form="prefix" lspace="0" rspace="0.2em">%s</mo>', text             # <<<<<<<<<<<<<<
 *                     )
 *                 return render("<mo>%s</mo>", text)
 */
        __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(__pyx_v_render, __pyx_kp_u_mo_form_prefix_lspace_0_rspace, __pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2878, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);

        /* "mathics/core/expression.py":2878
 *                     )
 *                 if text == "\u2062":
 *                     return render(             # <<<<<<<<<<<<<<
 *                         '<mo form="prefix" lspace="0" rspace="0.2em">%s</mo>', text
 *                     )
 */
        if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2878, __pyx_L1_error)
        __pyx_r = ((PyObject*)__pyx_t_1);
        __pyx_t_1 = 0;
        goto __pyx_L0;

        /* "mathics/core/expression.py":2877
 *                         '<mo form="prefix" lspace="0.2em" rspace="0">%s</mo>', text
 *                     )
 *                 if text == "\u2062":             # <<<<<<<<<<<<<<
 *                     return render(
 *                         '<mo form="prefix" lspace="0" rspace="0.2em">%s</mo>', text
 */
      }

      /* "mathics/core/expression.py":2881
 *                         '<mo form="prefix" lspace="0" rspace="0.2em">%s</mo>', text
 *                     )
 *                 return render("<mo>%s</mo>", text)             # <<<<<<<<<<<<<<
 *             elif is_symbol_name(text):
 *                 return render("<mi>%s</mi>", text)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(__pyx_v_render, __pyx_kp_u_mo_s_mo, __pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2881, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2881, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2872
 *             return render("<mn>%s</mn>", text)
 *         else:
 *             if text in operators or text in extra_operators:             # <<<<<<<<<<<<<<
 *                 if text == "\u2146":
 *                     return render(
 */
    }

    /* "mathics/core/expression.py":2882
 *                     )
 *                 return render("<mo>%s</mo>", text)
 *             elif is_symbol_name(text):             # <<<<<<<<<<<<<<
 *                 return render("<mi>%s</mi>", text)
 *             else:
 */
    __Pyx_INCREF(__pyx_v_is_symbol_name);
    __pyx_t_2 = __pyx_v_is_symbol_name; __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_v_text) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_text);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2882, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2882, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2883
 *                 return render("<mo>%s</mo>", text)
 *             elif is_symbol_name(text):
 *                 return render("<mi>%s</mi>", text)             # <<<<<<<<<<<<<<
 *             else:
 *                 outtext = ""
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(__pyx_v_render, __pyx_kp_u_mi_s_mi, __pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2883, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2882
 *                     )
 *                 return render("<mo>%s</mo>", text)
 *             elif is_symbol_name(text):             # <<<<<<<<<<<<<<
 *                 return render("<mi>%s</mi>", text)
 *             else:
 */
    }

    /* "mathics/core/expression.py":2885
 *                 return render("<mi>%s</mi>", text)
 *             else:
 *                 outtext = ""             # <<<<<<<<<<<<<<
 *                 for line in text.split("\n"):
 *                     outtext += render("<mtext>%s</mtext>", line)
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_kp_u__3);
      __pyx_v_outtext = __pyx_kp_u__3;

      /* "mathics/core/expression.py":2886
 *             else:
 *                 outtext = ""
 *                 for line in text.split("\n"):             # <<<<<<<<<<<<<<
 *                     outtext += render("<mtext>%s</mtext>", line)
 *                 return outtext
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_text, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_kp_u__82) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u__82);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
        __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
        __pyx_t_9 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2886, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2886, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        if (likely(!__pyx_t_9)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 2886, __pyx_L1_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2886, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          } else {
            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 2886, __pyx_L1_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2886, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          }
        } else {
          __pyx_t_1 = __pyx_t_9(__pyx_t_2);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 2886, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "mathics/core/expression.py":2887
 *                 outtext = ""
 *                 for line in text.split("\n"):
 *                     outtext += render("<mtext>%s</mtext>", line)             # <<<<<<<<<<<<<<
 *                 return outtext
 * 
 */
        __pyx_t_1 = __pyx_pf_7mathics_4core_10expression_6String_15boxes_to_mathml_render(__pyx_v_render, __pyx_kp_u_mtext_s_mtext, __pyx_v_line); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2887, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_v_outtext, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2887, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_outtext, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "mathics/core/expression.py":2886
 *             else:
 *                 outtext = ""
 *                 for line in text.split("\n"):             # <<<<<<<<<<<<<<
 *                     outtext += render("<mtext>%s</mtext>", line)
 *                 return outtext
 */
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/core/expression.py":2888
 *                 for line in text.split("\n"):
 *                     outtext += render("<mtext>%s</mtext>", line)
 *                 return outtext             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_tex(self, show_string_characters=False, **options) -> str:
 */
      __Pyx_XDECREF(__pyx_r);
      if (!(likely(PyUnicode_CheckExact(__pyx_v_outtext))||((__pyx_v_outtext) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_outtext)->tp_name), 0))) __PYX_ERR(0, 2888, __pyx_L1_error)
      __Pyx_INCREF(__pyx_v_outtext);
      __pyx_r = ((PyObject*)__pyx_v_outtext);
      goto __pyx_L0;
    }
  }

  /* "mathics/core/expression.py":2843
 *         return value
 * 
 *     def boxes_to_mathml(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         from mathics.core.parser import is_symbol_name
 *         from mathics.builtin import builtins_by_module
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("mathics.core.expression.String.boxes_to_mathml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_is_symbol_name);
  __Pyx_XDECREF(__pyx_v_builtins_by_module);
  __Pyx_XDECREF(__pyx_v_operators);
  __Pyx_XDECREF(__pyx_v_modname);
  __Pyx_XDECREF(__pyx_v_builtins);
  __Pyx_XDECREF(__pyx_v_builtin);
  __Pyx_XDECREF(__pyx_v_operator);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XDECREF(__pyx_v_render);
  __Pyx_XDECREF(__pyx_v_outtext);
  __Pyx_XDECREF(__pyx_v_line);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2890
 *                 return outtext
 * 
 *     def boxes_to_tex(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         from mathics.builtin import builtins_by_module
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_9boxes_to_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_9boxes_to_tex = {"boxes_to_tex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_9boxes_to_tex, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_9boxes_to_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_show_string_characters = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_tex (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_show_string_characters,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_show_string_characters);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_tex") < 0)) __PYX_ERR(0, 2890, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_show_string_characters = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_tex", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2890, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.String.boxes_to_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_8boxes_to_tex(__pyx_self, __pyx_v_self, __pyx_v_show_string_characters, __pyx_v_options);

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

/* "mathics/core/expression.py":2903
 *         text = self.value
 * 
 *         def render(format, string, in_text=False):             # <<<<<<<<<<<<<<
 *             return format % encode_tex(string, in_text)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_12boxes_to_tex_1render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_12boxes_to_tex_1render = {"render", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_12boxes_to_tex_1render, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_12boxes_to_tex_1render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_v_string = 0;
  PyObject *__pyx_v_in_text = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_format,&__pyx_n_s_string,&__pyx_n_s_in_text,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_format)) != 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_string)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 0, 2, 3, 1); __PYX_ERR(0, 2903, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_in_text);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "render") < 0)) __PYX_ERR(0, 2903, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_format = values[0];
    __pyx_v_string = values[1];
    __pyx_v_in_text = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("render", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2903, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.String.boxes_to_tex.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_12boxes_to_tex_render(__pyx_self, __pyx_v_format, __pyx_v_string, __pyx_v_in_text);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6String_12boxes_to_tex_render(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_format, PyObject *__pyx_v_string, PyObject *__pyx_v_in_text) {
  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("render", 0);

  /* "mathics/core/expression.py":2904
 * 
 *         def render(format, string, in_text=False):
 *             return format % encode_tex(string, in_text)             # <<<<<<<<<<<<<<
 * 
 *         if text.startswith('"') and text.endswith('"'):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_tex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2904, __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_string, __pyx_v_in_text};
    __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, 2904, __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_string, __pyx_v_in_text};
    __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, 2904, __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, 2904, __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_string);
    __Pyx_GIVEREF(__pyx_v_string);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_string);
    __Pyx_INCREF(__pyx_v_in_text);
    __Pyx_GIVEREF(__pyx_v_in_text);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_in_text);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2904, __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_t_2 = PyNumber_Remainder(__pyx_v_format, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2904, __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;

  /* "mathics/core/expression.py":2903
 *         text = self.value
 * 
 *         def render(format, string, in_text=False):             # <<<<<<<<<<<<<<
 *             return format % encode_tex(string, in_text)
 * 
 */

  /* 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("mathics.core.expression.String.boxes_to_tex.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2890
 *                 return outtext
 * 
 *     def boxes_to_tex(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         from mathics.builtin import builtins_by_module
 * 
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_6String_8boxes_to_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_show_string_characters, CYTHON_UNUSED PyObject *__pyx_v_options) {
  PyObject *__pyx_v_builtins_by_module = NULL;
  PyObject *__pyx_v_operators = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_modname = NULL;
  PyObject *__pyx_v_builtins = NULL;
  PyObject *__pyx_v_builtin = NULL;
  PyObject *__pyx_v_operator = NULL;
  PyObject *__pyx_v_text = NULL;
  PyObject *__pyx_v_render = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("boxes_to_tex", 0);

  /* "mathics/core/expression.py":2891
 * 
 *     def boxes_to_tex(self, show_string_characters=False, **options) -> str:
 *         from mathics.builtin import builtins_by_module             # <<<<<<<<<<<<<<
 * 
 *         operators = set()
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_builtins_by_module);
  __Pyx_GIVEREF(__pyx_n_s_builtins_by_module);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_builtins_by_module);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_builtin, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2891, __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_builtins_by_module); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_builtins_by_module = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2893
 *         from mathics.builtin import builtins_by_module
 * 
 *         operators = set()             # <<<<<<<<<<<<<<
 * 
 *         for modname, builtins in builtins_by_module.items():
 */
  __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_operators = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2895
 *         operators = set()
 * 
 *         for modname, builtins in builtins_by_module.items():             # <<<<<<<<<<<<<<
 *             for builtin in builtins:
 *                 operator = builtin.get_operator_display()
 */
  __pyx_t_3 = 0;
  if (unlikely(__pyx_v_builtins_by_module == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 2895, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_dict_iterator(__pyx_v_builtins_by_module, 0, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = __pyx_t_1;
  __pyx_t_1 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_1, &__pyx_t_6, NULL, __pyx_t_5);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 2895, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_modname, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_builtins, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "mathics/core/expression.py":2896
 * 
 *         for modname, builtins in builtins_by_module.items():
 *             for builtin in builtins:             # <<<<<<<<<<<<<<
 *                 operator = builtin.get_operator_display()
 *                 if operator is not None:
 */
    if (likely(PyList_CheckExact(__pyx_v_builtins)) || PyTuple_CheckExact(__pyx_v_builtins)) {
      __pyx_t_6 = __pyx_v_builtins; __Pyx_INCREF(__pyx_t_6); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_builtins); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2896, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2896, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 2896, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2896, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 2896, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2896, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_9(__pyx_t_6);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2896, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_builtin, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/core/expression.py":2897
 *         for modname, builtins in builtins_by_module.items():
 *             for builtin in builtins:
 *                 operator = builtin.get_operator_display()             # <<<<<<<<<<<<<<
 *                 if operator is not None:
 *                     operators.add(operator)
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_builtin, __pyx_n_s_get_operator_display); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2897, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2897, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_operator, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/core/expression.py":2898
 *             for builtin in builtins:
 *                 operator = builtin.get_operator_display()
 *                 if operator is not None:             # <<<<<<<<<<<<<<
 *                     operators.add(operator)
 * 
 */
      __pyx_t_12 = (__pyx_v_operator != Py_None);
      __pyx_t_13 = (__pyx_t_12 != 0);
      if (__pyx_t_13) {

        /* "mathics/core/expression.py":2899
 *                 operator = builtin.get_operator_display()
 *                 if operator is not None:
 *                     operators.add(operator)             # <<<<<<<<<<<<<<
 * 
 *         text = self.value
 */
        __pyx_t_14 = PySet_Add(__pyx_v_operators, __pyx_v_operator); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 2899, __pyx_L1_error)

        /* "mathics/core/expression.py":2898
 *             for builtin in builtins:
 *                 operator = builtin.get_operator_display()
 *                 if operator is not None:             # <<<<<<<<<<<<<<
 *                     operators.add(operator)
 * 
 */
      }

      /* "mathics/core/expression.py":2896
 * 
 *         for modname, builtins in builtins_by_module.items():
 *             for builtin in builtins:             # <<<<<<<<<<<<<<
 *                 operator = builtin.get_operator_display()
 *                 if operator is not None:
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2901
 *                     operators.add(operator)
 * 
 *         text = self.value             # <<<<<<<<<<<<<<
 * 
 *         def render(format, string, in_text=False):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_text = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2903
 *         text = self.value
 * 
 *         def render(format, string, in_text=False):             # <<<<<<<<<<<<<<
 *             return format % encode_tex(string, in_text)
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_12boxes_to_tex_1render, 0, __pyx_n_s_String_boxes_to_tex_locals_rende, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__92)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__93);
  __pyx_v_render = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2906
 *             return format % encode_tex(string, in_text)
 * 
 *         if text.startswith('"') and text.endswith('"'):             # <<<<<<<<<<<<<<
 *             if show_string_characters:
 *                 return render(r'\text{"%s"}', text[1:-1], in_text=True)
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_text, __pyx_n_s_startswith); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_kp_u__81) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u__81);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2906, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_12) {
  } else {
    __pyx_t_13 = __pyx_t_12;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_text, __pyx_n_s_endswith); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_1, __pyx_kp_u__81) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u__81);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2906, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_13 = __pyx_t_12;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_13) {

    /* "mathics/core/expression.py":2907
 * 
 *         if text.startswith('"') and text.endswith('"'):
 *             if show_string_characters:             # <<<<<<<<<<<<<<
 *                 return render(r'\text{"%s"}', text[1:-1], in_text=True)
 *             else:
 */
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_show_string_characters); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2907, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2908
 *         if text.startswith('"') and text.endswith('"'):
 *             if show_string_characters:
 *                 return render(r'\text{"%s"}', text[1:-1], in_text=True)             # <<<<<<<<<<<<<<
 *             else:
 *                 return render(r"\text{%s}", text[1:-1], in_text=True)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_text, 1, -1L, NULL, NULL, &__pyx_slice__85, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2908, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2908, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_kp_u_text_s);
      __Pyx_GIVEREF(__pyx_kp_u_text_s);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_text_s);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2908, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_in_text, Py_True) < 0) __PYX_ERR(0, 2908, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_render, __pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2908, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2908, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2907
 * 
 *         if text.startswith('"') and text.endswith('"'):
 *             if show_string_characters:             # <<<<<<<<<<<<<<
 *                 return render(r'\text{"%s"}', text[1:-1], in_text=True)
 *             else:
 */
    }

    /* "mathics/core/expression.py":2910
 *                 return render(r'\text{"%s"}', text[1:-1], in_text=True)
 *             else:
 *                 return render(r"\text{%s}", text[1:-1], in_text=True)             # <<<<<<<<<<<<<<
 *         elif text and text[0] in "0123456789-.":
 *             return render("%s", text)
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_text, 1, -1L, NULL, NULL, &__pyx_slice__85, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2910, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2910, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_kp_u_text_s_2);
      __Pyx_GIVEREF(__pyx_kp_u_text_s_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_text_s_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2910, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_in_text, Py_True) < 0) __PYX_ERR(0, 2910, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_render, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2910, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 2910, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L0;
    }

    /* "mathics/core/expression.py":2906
 *             return format % encode_tex(string, in_text)
 * 
 *         if text.startswith('"') and text.endswith('"'):             # <<<<<<<<<<<<<<
 *             if show_string_characters:
 *                 return render(r'\text{"%s"}', text[1:-1], in_text=True)
 */
  }

  /* "mathics/core/expression.py":2911
 *             else:
 *                 return render(r"\text{%s}", text[1:-1], in_text=True)
 *         elif text and text[0] in "0123456789-.":             # <<<<<<<<<<<<<<
 *             return render("%s", text)
 *         else:
 */
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_text); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2911, __pyx_L1_error)
  if (__pyx_t_12) {
  } else {
    __pyx_t_13 = __pyx_t_12;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_text, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_12 = (__Pyx_PyUnicode_ContainsTF(__pyx_t_6, __pyx_kp_u_0123456789, Py_EQ)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2911, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_15 = (__pyx_t_12 != 0);
  __pyx_t_13 = __pyx_t_15;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_13) {

    /* "mathics/core/expression.py":2912
 *                 return render(r"\text{%s}", text[1:-1], in_text=True)
 *         elif text and text[0] in "0123456789-.":
 *             return render("%s", text)             # <<<<<<<<<<<<<<
 *         else:
 *             if text == "\u2032":
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_kp_u_s_5);
    __Pyx_GIVEREF(__pyx_kp_u_s_5);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_s_5);
    __Pyx_INCREF(__pyx_v_text);
    __Pyx_GIVEREF(__pyx_v_text);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_text);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_render, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2912, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2911
 *             else:
 *                 return render(r"\text{%s}", text[1:-1], in_text=True)
 *         elif text and text[0] in "0123456789-.":             # <<<<<<<<<<<<<<
 *             return render("%s", text)
 *         else:
 */
  }

  /* "mathics/core/expression.py":2914
 *             return render("%s", text)
 *         else:
 *             if text == "\u2032":             # <<<<<<<<<<<<<<
 *                 return "'"
 *             elif text == "\u2032\u2032":
 */
  /*else*/ {
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__58, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2914, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2915
 *         else:
 *             if text == "\u2032":
 *                 return "'"             # <<<<<<<<<<<<<<
 *             elif text == "\u2032\u2032":
 *                 return "''"
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u__94);
      __pyx_r = __pyx_kp_u__94;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2914
 *             return render("%s", text)
 *         else:
 *             if text == "\u2032":             # <<<<<<<<<<<<<<
 *                 return "'"
 *             elif text == "\u2032\u2032":
 */
    }

    /* "mathics/core/expression.py":2916
 *             if text == "\u2032":
 *                 return "'"
 *             elif text == "\u2032\u2032":             # <<<<<<<<<<<<<<
 *                 return "''"
 *             elif text == "\u2062":
 */
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__59, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2916, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2917
 *                 return "'"
 *             elif text == "\u2032\u2032":
 *                 return "''"             # <<<<<<<<<<<<<<
 *             elif text == "\u2062":
 *                 return " "
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u__95);
      __pyx_r = __pyx_kp_u__95;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2916
 *             if text == "\u2032":
 *                 return "'"
 *             elif text == "\u2032\u2032":             # <<<<<<<<<<<<<<
 *                 return "''"
 *             elif text == "\u2062":
 */
    }

    /* "mathics/core/expression.py":2918
 *             elif text == "\u2032\u2032":
 *                 return "''"
 *             elif text == "\u2062":             # <<<<<<<<<<<<<<
 *                 return " "
 *             elif text == "\u221e":
 */
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__90, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2918, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2919
 *                 return "''"
 *             elif text == "\u2062":
 *                 return " "             # <<<<<<<<<<<<<<
 *             elif text == "\u221e":
 *                 return r"\infty "
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u__53);
      __pyx_r = __pyx_kp_u__53;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2918
 *             elif text == "\u2032\u2032":
 *                 return "''"
 *             elif text == "\u2062":             # <<<<<<<<<<<<<<
 *                 return " "
 *             elif text == "\u221e":
 */
    }

    /* "mathics/core/expression.py":2920
 *             elif text == "\u2062":
 *                 return " "
 *             elif text == "\u221e":             # <<<<<<<<<<<<<<
 *                 return r"\infty "
 *             elif text == "\u00d7":
 */
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__96, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2920, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2921
 *                 return " "
 *             elif text == "\u221e":
 *                 return r"\infty "             # <<<<<<<<<<<<<<
 *             elif text == "\u00d7":
 *                 return r"\times "
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u_infty);
      __pyx_r = __pyx_kp_u_infty;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2920
 *             elif text == "\u2062":
 *                 return " "
 *             elif text == "\u221e":             # <<<<<<<<<<<<<<
 *                 return r"\infty "
 *             elif text == "\u00d7":
 */
    }

    /* "mathics/core/expression.py":2922
 *             elif text == "\u221e":
 *                 return r"\infty "
 *             elif text == "\u00d7":             # <<<<<<<<<<<<<<
 *                 return r"\times "
 *             elif text in ("(", "[", "{"):
 */
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__97, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2922, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2923
 *                 return r"\infty "
 *             elif text == "\u00d7":
 *                 return r"\times "             # <<<<<<<<<<<<<<
 *             elif text in ("(", "[", "{"):
 *                 return render(r"\left%s", text)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u_times);
      __pyx_r = __pyx_kp_u_times;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2922
 *             elif text == "\u221e":
 *                 return r"\infty "
 *             elif text == "\u00d7":             # <<<<<<<<<<<<<<
 *                 return r"\times "
 *             elif text in ("(", "[", "{"):
 */
    }

    /* "mathics/core/expression.py":2924
 *             elif text == "\u00d7":
 *                 return r"\times "
 *             elif text in ("(", "[", "{"):             # <<<<<<<<<<<<<<
 *                 return render(r"\left%s", text)
 *             elif text in (")", "]", "}"):
 */
    __Pyx_INCREF(__pyx_v_text);
    __pyx_t_1 = __pyx_v_text;
    __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u__98, Py_EQ)); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 2924, __pyx_L1_error)
    if (!__pyx_t_15) {
    } else {
      __pyx_t_13 = __pyx_t_15;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u__33, Py_EQ)); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 2924, __pyx_L1_error)
    if (!__pyx_t_15) {
    } else {
      __pyx_t_13 = __pyx_t_15;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_kp_u__51, Py_EQ)); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 2924, __pyx_L1_error)
    __pyx_t_13 = __pyx_t_15;
    __pyx_L15_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_15 = (__pyx_t_13 != 0);
    if (__pyx_t_15) {

      /* "mathics/core/expression.py":2925
 *                 return r"\times "
 *             elif text in ("(", "[", "{"):
 *                 return render(r"\left%s", text)             # <<<<<<<<<<<<<<
 *             elif text in (")", "]", "}"):
 *                 return render(r"\right%s", text)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2925, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_kp_u_left_s);
      __Pyx_GIVEREF(__pyx_kp_u_left_s);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_left_s);
      __Pyx_INCREF(__pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_text);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_render, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2925, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 2925, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2924
 *             elif text == "\u00d7":
 *                 return r"\times "
 *             elif text in ("(", "[", "{"):             # <<<<<<<<<<<<<<
 *                 return render(r"\left%s", text)
 *             elif text in (")", "]", "}"):
 */
    }

    /* "mathics/core/expression.py":2926
 *             elif text in ("(", "[", "{"):
 *                 return render(r"\left%s", text)
 *             elif text in (")", "]", "}"):             # <<<<<<<<<<<<<<
 *                 return render(r"\right%s", text)
 *             elif text == "\u301a":
 */
    __Pyx_INCREF(__pyx_v_text);
    __pyx_t_6 = __pyx_v_text;
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_kp_u__75, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2926, __pyx_L1_error)
    if (!__pyx_t_13) {
    } else {
      __pyx_t_15 = __pyx_t_13;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_kp_u__35, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2926, __pyx_L1_error)
    if (!__pyx_t_13) {
    } else {
      __pyx_t_15 = __pyx_t_13;
      goto __pyx_L18_bool_binop_done;
    }
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_kp_u__52, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2926, __pyx_L1_error)
    __pyx_t_15 = __pyx_t_13;
    __pyx_L18_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_13 = (__pyx_t_15 != 0);
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2927
 *                 return render(r"\left%s", text)
 *             elif text in (")", "]", "}"):
 *                 return render(r"\right%s", text)             # <<<<<<<<<<<<<<
 *             elif text == "\u301a":
 *                 return r"\left[\left["
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2927, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_kp_u_right_s);
      __Pyx_GIVEREF(__pyx_kp_u_right_s);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_right_s);
      __Pyx_INCREF(__pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_text);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_render, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2927, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2927, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2926
 *             elif text in ("(", "[", "{"):
 *                 return render(r"\left%s", text)
 *             elif text in (")", "]", "}"):             # <<<<<<<<<<<<<<
 *                 return render(r"\right%s", text)
 *             elif text == "\u301a":
 */
    }

    /* "mathics/core/expression.py":2928
 *             elif text in (")", "]", "}"):
 *                 return render(r"\right%s", text)
 *             elif text == "\u301a":             # <<<<<<<<<<<<<<
 *                 return r"\left[\left["
 *             elif text == "\u301b":
 */
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__99, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2928, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2929
 *                 return render(r"\right%s", text)
 *             elif text == "\u301a":
 *                 return r"\left[\left["             # <<<<<<<<<<<<<<
 *             elif text == "\u301b":
 *                 return r"\right]\right]"
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u_left_left);
      __pyx_r = __pyx_kp_u_left_left;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2928
 *             elif text in (")", "]", "}"):
 *                 return render(r"\right%s", text)
 *             elif text == "\u301a":             # <<<<<<<<<<<<<<
 *                 return r"\left[\left["
 *             elif text == "\u301b":
 */
    }

    /* "mathics/core/expression.py":2930
 *             elif text == "\u301a":
 *                 return r"\left[\left["
 *             elif text == "\u301b":             # <<<<<<<<<<<<<<
 *                 return r"\right]\right]"
 *             elif text == "," or text == ", ":
 */
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__100, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2930, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2931
 *                 return r"\left[\left["
 *             elif text == "\u301b":
 *                 return r"\right]\right]"             # <<<<<<<<<<<<<<
 *             elif text == "," or text == ", ":
 *                 return text
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u_right_right);
      __pyx_r = __pyx_kp_u_right_right;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2930
 *             elif text == "\u301a":
 *                 return r"\left[\left["
 *             elif text == "\u301b":             # <<<<<<<<<<<<<<
 *                 return r"\right]\right]"
 *             elif text == "," or text == ", ":
 */
    }

    /* "mathics/core/expression.py":2932
 *             elif text == "\u301b":
 *                 return r"\right]\right]"
 *             elif text == "," or text == ", ":             # <<<<<<<<<<<<<<
 *                 return text
 *             elif text == "\u222b":
 */
    __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__48, Py_EQ)); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 2932, __pyx_L1_error)
    if (!__pyx_t_15) {
    } else {
      __pyx_t_13 = __pyx_t_15;
      goto __pyx_L21_bool_binop_done;
    }
    __pyx_t_15 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__34, Py_EQ)); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 2932, __pyx_L1_error)
    __pyx_t_13 = __pyx_t_15;
    __pyx_L21_bool_binop_done:;
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2933
 *                 return r"\right]\right]"
 *             elif text == "," or text == ", ":
 *                 return text             # <<<<<<<<<<<<<<
 *             elif text == "\u222b":
 *                 return r"\int"
 */
      __Pyx_XDECREF(__pyx_r);
      if (!(likely(PyUnicode_CheckExact(__pyx_v_text))||((__pyx_v_text) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_text)->tp_name), 0))) __PYX_ERR(0, 2933, __pyx_L1_error)
      __Pyx_INCREF(__pyx_v_text);
      __pyx_r = ((PyObject*)__pyx_v_text);
      goto __pyx_L0;

      /* "mathics/core/expression.py":2932
 *             elif text == "\u301b":
 *                 return r"\right]\right]"
 *             elif text == "," or text == ", ":             # <<<<<<<<<<<<<<
 *                 return text
 *             elif text == "\u222b":
 */
    }

    /* "mathics/core/expression.py":2934
 *             elif text == "," or text == ", ":
 *                 return text
 *             elif text == "\u222b":             # <<<<<<<<<<<<<<
 *                 return r"\int"
 *             elif text == "\u2146":
 */
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__101, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2934, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2935
 *                 return text
 *             elif text == "\u222b":
 *                 return r"\int"             # <<<<<<<<<<<<<<
 *             elif text == "\u2146":
 *                 return r"\, d"
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u_int);
      __pyx_r = __pyx_kp_u_int;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2934
 *             elif text == "," or text == ", ":
 *                 return text
 *             elif text == "\u222b":             # <<<<<<<<<<<<<<
 *                 return r"\int"
 *             elif text == "\u2146":
 */
    }

    /* "mathics/core/expression.py":2936
 *             elif text == "\u222b":
 *                 return r"\int"
 *             elif text == "\u2146":             # <<<<<<<<<<<<<<
 *                 return r"\, d"
 *             elif text == "\u2211":
 */
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_n_u__89, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2936, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2937
 *                 return r"\int"
 *             elif text == "\u2146":
 *                 return r"\, d"             # <<<<<<<<<<<<<<
 *             elif text == "\u2211":
 *                 return r"\sum"
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u_d_2);
      __pyx_r = __pyx_kp_u_d_2;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2936
 *             elif text == "\u222b":
 *                 return r"\int"
 *             elif text == "\u2146":             # <<<<<<<<<<<<<<
 *                 return r"\, d"
 *             elif text == "\u2211":
 */
    }

    /* "mathics/core/expression.py":2938
 *             elif text == "\u2146":
 *                 return r"\, d"
 *             elif text == "\u2211":             # <<<<<<<<<<<<<<
 *                 return r"\sum"
 *             elif text == "\u220f":
 */
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__102, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2938, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2939
 *                 return r"\, d"
 *             elif text == "\u2211":
 *                 return r"\sum"             # <<<<<<<<<<<<<<
 *             elif text == "\u220f":
 *                 return r"\prod"
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u_sum);
      __pyx_r = __pyx_kp_u_sum;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2938
 *             elif text == "\u2146":
 *                 return r"\, d"
 *             elif text == "\u2211":             # <<<<<<<<<<<<<<
 *                 return r"\sum"
 *             elif text == "\u220f":
 */
    }

    /* "mathics/core/expression.py":2940
 *             elif text == "\u2211":
 *                 return r"\sum"
 *             elif text == "\u220f":             # <<<<<<<<<<<<<<
 *                 return r"\prod"
 *             elif len(text) > 1:
 */
    __pyx_t_13 = (__Pyx_PyUnicode_Equals(__pyx_v_text, __pyx_kp_u__103, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 2940, __pyx_L1_error)
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2941
 *                 return r"\sum"
 *             elif text == "\u220f":
 *                 return r"\prod"             # <<<<<<<<<<<<<<
 *             elif len(text) > 1:
 *                 return render(r"\text{%s}", text, in_text=True)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_kp_u_prod);
      __pyx_r = __pyx_kp_u_prod;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2940
 *             elif text == "\u2211":
 *                 return r"\sum"
 *             elif text == "\u220f":             # <<<<<<<<<<<<<<
 *                 return r"\prod"
 *             elif len(text) > 1:
 */
    }

    /* "mathics/core/expression.py":2942
 *             elif text == "\u220f":
 *                 return r"\prod"
 *             elif len(text) > 1:             # <<<<<<<<<<<<<<
 *                 return render(r"\text{%s}", text, in_text=True)
 *             else:
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_text); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2942, __pyx_L1_error)
    __pyx_t_13 = ((__pyx_t_4 > 1) != 0);
    if (__pyx_t_13) {

      /* "mathics/core/expression.py":2943
 *                 return r"\prod"
 *             elif len(text) > 1:
 *                 return render(r"\text{%s}", text, in_text=True)             # <<<<<<<<<<<<<<
 *             else:
 *                 return render("%s", text)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_kp_u_text_s_2);
      __Pyx_GIVEREF(__pyx_kp_u_text_s_2);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_text_s_2);
      __Pyx_INCREF(__pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_text);
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_in_text, Py_True) < 0) __PYX_ERR(0, 2943, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_render, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 2943, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":2942
 *             elif text == "\u220f":
 *                 return r"\prod"
 *             elif len(text) > 1:             # <<<<<<<<<<<<<<
 *                 return render(r"\text{%s}", text, in_text=True)
 *             else:
 */
    }

    /* "mathics/core/expression.py":2945
 *                 return render(r"\text{%s}", text, in_text=True)
 *             else:
 *                 return render("%s", text)             # <<<<<<<<<<<<<<
 * 
 *     def atom_to_boxes(self, f, evaluation):
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_kp_u_s_5);
      __Pyx_GIVEREF(__pyx_kp_u_s_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_s_5);
      __Pyx_INCREF(__pyx_v_text);
      __Pyx_GIVEREF(__pyx_v_text);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_text);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_v_render, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 2945, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L0;
    }
  }

  /* "mathics/core/expression.py":2890
 *                 return outtext
 * 
 *     def boxes_to_tex(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         from mathics.builtin import builtins_by_module
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("mathics.core.expression.String.boxes_to_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_builtins_by_module);
  __Pyx_XDECREF(__pyx_v_operators);
  __Pyx_XDECREF(__pyx_v_modname);
  __Pyx_XDECREF(__pyx_v_builtins);
  __Pyx_XDECREF(__pyx_v_builtin);
  __Pyx_XDECREF(__pyx_v_operator);
  __Pyx_XDECREF(__pyx_v_text);
  __Pyx_XDECREF(__pyx_v_render);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2947
 *                 return render("%s", text)
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         inner = str(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_11atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_11atom_to_boxes = {"atom_to_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_11atom_to_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_11atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_f = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atom_to_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_f,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 1); __PYX_ERR(0, 2947, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 2); __PYX_ERR(0, 2947, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atom_to_boxes") < 0)) __PYX_ERR(0, 2947, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_f = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2947, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.String.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_10atom_to_boxes(__pyx_self, __pyx_v_self, __pyx_v_f, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6String_10atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_inner = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("atom_to_boxes", 0);

  /* "mathics/core/expression.py":2948
 * 
 *     def atom_to_boxes(self, f, evaluation):
 *         inner = str(self.value)             # <<<<<<<<<<<<<<
 * 
 *         if f.get_name() in system_symbols("InputForm", "FullForm"):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_inner = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2950
 *         inner = str(self.value)
 * 
 *         if f.get_name() in system_symbols("InputForm", "FullForm"):             # <<<<<<<<<<<<<<
 *             inner = inner.replace("\\", "\\\\")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_system_symbols); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__104, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_t_2, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2950, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":2951
 * 
 *         if f.get_name() in system_symbols("InputForm", "FullForm"):
 *             inner = inner.replace("\\", "\\\\")             # <<<<<<<<<<<<<<
 * 
 *         return String('"' + inner + '"')
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_inner, __pyx_n_s_replace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2951, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__107, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2951, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_inner, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":2950
 *         inner = str(self.value)
 * 
 *         if f.get_name() in system_symbols("InputForm", "FullForm"):             # <<<<<<<<<<<<<<
 *             inner = inner.replace("\\", "\\\\")
 * 
 */
  }

  /* "mathics/core/expression.py":2953
 *             inner = inner.replace("\\", "\\\\")
 * 
 *         return String('"' + inner + '"')             # <<<<<<<<<<<<<<
 * 
 *     def do_copy(self) -> "String":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_String); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_Add(__pyx_kp_u__81, __pyx_v_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_kp_u__81); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2947
 *                 return render("%s", text)
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         inner = str(self.value)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.String.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_inner);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2955
 *         return String('"' + inner + '"')
 * 
 *     def do_copy(self) -> "String":             # <<<<<<<<<<<<<<
 *         return String(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_13do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_13do_copy = {"do_copy", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6String_13do_copy, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_13do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_12do_copy(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2956
 * 
 *     def do_copy(self) -> "String":
 *         return String(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def default_format(self, evaluation, form) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_String); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2956, __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;

  /* "mathics/core/expression.py":2955
 *         return String('"' + inner + '"')
 * 
 *     def do_copy(self) -> "String":             # <<<<<<<<<<<<<<
 *         return String(self.value)
 * 
 */

  /* 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("mathics.core.expression.String.do_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2958
 *         return String(self.value)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value.replace("\\", "\\\\").replace('"', '\\"')
 *         return '"%s"' % value
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_15default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_15default_format = {"default_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_15default_format, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_15default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  CYTHON_UNUSED PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 1); __PYX_ERR(0, 2958, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 2); __PYX_ERR(0, 2958, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_format") < 0)) __PYX_ERR(0, 2958, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2958, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.String.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_14default_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6String_14default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation, CYTHON_UNUSED PyObject *__pyx_v_form) {
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("default_format", 0);

  /* "mathics/core/expression.py":2959
 * 
 *     def default_format(self, evaluation, form) -> str:
 *         value = self.value.replace("\\", "\\\\").replace('"', '\\"')             # <<<<<<<<<<<<<<
 *         return '"%s"' % value
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_replace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__107, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_replace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__109, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_value = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2960
 *     def default_format(self, evaluation, form) -> str:
 *         value = self.value.replace("\\", "\\\\").replace('"', '\\"')
 *         return '"%s"' % value             # <<<<<<<<<<<<<<
 * 
 *     def get_sort_key(self, pattern_sort=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s_4, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2958
 *         return String(self.value)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value.replace("\\", "\\\\").replace('"', '\\"')
 *         return '"%s"' % value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.core.expression.String.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2962
 *         return '"%s"' % value
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_17get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_17get_sort_key = {"get_sort_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_17get_sort_key, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_17get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_pattern_sort = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sort_key (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_pattern_sort,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_sort);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_sort_key") < 0)) __PYX_ERR(0, 2962, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_pattern_sort = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_sort_key", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2962, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.String.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_16get_sort_key(__pyx_self, __pyx_v_self, __pyx_v_pattern_sort);

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

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

  /* "mathics/core/expression.py":2963
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_sort); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2963, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":2964
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:
 *             return super().get_sort_key(True)             # <<<<<<<<<<<<<<
 *         else:
 *             return [0, 1, self.value, 0, 1]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_CyFunction_GetClassObj(__pyx_self);
    if (!__pyx_t_3) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 2964, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2964, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2963
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         else:
 */
  }

  /* "mathics/core/expression.py":2966
 *             return super().get_sort_key(True)
 *         else:
 *             return [0, 1, self.value, 0, 1]             # <<<<<<<<<<<<<<
 * 
 *     def sameQ(self, other) -> bool:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyList_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_4, 3, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_4, 4, __pyx_int_1);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2962
 *         return '"%s"' % value
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.String.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2968
 *             return [0, 1, self.value, 0, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, String) and self.value == other.value
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_19sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_6String_18sameQ[] = "Mathics SameQ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_19sameQ = {"sameQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_19sameQ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_6String_18sameQ};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_19sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sameQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, 1); __PYX_ERR(0, 2968, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sameQ") < 0)) __PYX_ERR(0, 2968, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2968, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.String.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_18sameQ(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":2970
 *     def sameQ(self, other) -> bool:
 *         """Mathics SameQ"""
 *         return isinstance(other, String) and self.value == other.value             # <<<<<<<<<<<<<<
 * 
 *     def get_string_value(self) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_String); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_other, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2970, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2970, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2970, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_1 = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2968
 *             return [0, 1, self.value, 0, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, String) and self.value == other.value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.String.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2972
 *         return isinstance(other, String) and self.value == other.value
 * 
 *     def get_string_value(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_21get_string_value(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_21get_string_value = {"get_string_value", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6String_21get_string_value, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_21get_string_value(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_string_value (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_20get_string_value(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2973
 * 
 *     def get_string_value(self) -> str:
 *         return self.value             # <<<<<<<<<<<<<<
 * 
 *     def to_sympy(self, **kwargs):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2973, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2972
 *         return isinstance(other, String) and self.value == other.value
 * 
 *     def get_string_value(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.String.get_string_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2975
 *         return self.value
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_23to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_23to_sympy = {"to_sympy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_23to_sympy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_23to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED 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("to_sympy (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "to_sympy") < 0)) __PYX_ERR(0, 2975, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_sympy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2975, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.String.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_22to_sympy(__pyx_self, __pyx_v_self, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6String_22to_sympy(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_sympy", 0);

  /* "mathics/core/expression.py":2976
 * 
 *     def to_sympy(self, **kwargs):
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def to_python(self, *args, **kwargs) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":2975
 *         return self.value
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "mathics/core/expression.py":2978
 *         return None
 * 
 *     def to_python(self, *args, **kwargs) -> str:             # <<<<<<<<<<<<<<
 *         if kwargs.get("string_quotes", True):
 *             return '"%s"' % self.value  # add quotes to distinguish from Symbols
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_25to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_25to_python = {"to_python", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_25to_python, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_25to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED 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("to_python (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_self,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_self)) != 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, "to_python") < 0)) __PYX_ERR(0, 2978, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_python", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2978, __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("mathics.core.expression.String.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_24to_python(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

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

  /* "mathics/core/expression.py":2979
 * 
 *     def to_python(self, *args, **kwargs) -> str:
 *         if kwargs.get("string_quotes", True):             # <<<<<<<<<<<<<<
 *             return '"%s"' % self.value  # add quotes to distinguish from Symbols
 *         else:
 */
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_u_string_quotes, Py_True); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 2979, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":2980
 *     def to_python(self, *args, **kwargs) -> str:
 *         if kwargs.get("string_quotes", True):
 *             return '"%s"' % self.value  # add quotes to distinguish from Symbols             # <<<<<<<<<<<<<<
 *         else:
 *             return self.value
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_s_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":2979
 * 
 *     def to_python(self, *args, **kwargs) -> str:
 *         if kwargs.get("string_quotes", True):             # <<<<<<<<<<<<<<
 *             return '"%s"' % self.value  # add quotes to distinguish from Symbols
 *         else:
 */
  }

  /* "mathics/core/expression.py":2982
 *             return '"%s"' % self.value  # add quotes to distinguish from Symbols
 *         else:
 *             return self.value             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 2982, __pyx_L1_error)
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":2978
 *         return None
 * 
 *     def to_python(self, *args, **kwargs) -> str:             # <<<<<<<<<<<<<<
 *         if kwargs.get("string_quotes", True):
 *             return '"%s"' % self.value  # add quotes to distinguish from Symbols
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.String.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":2984
 *             return self.value
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("String", self.value))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_27__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_27__hash__ = {"__hash__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6String_27__hash__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_27__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_26__hash__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2985
 * 
 *     def __hash__(self):
 *         return hash(("String", self.value))             # <<<<<<<<<<<<<<
 * 
 *     def user_hash(self, update):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_String);
  __Pyx_GIVEREF(__pyx_n_u_String);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_String);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_Hash(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_hash_t)-1))) __PYX_ERR(0, 2985, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_FromHash_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2984
 *             return self.value
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("String", self.value))
 * 
 */

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

/* "mathics/core/expression.py":2987
 *         return hash(("String", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # hashing a String is the one case where the user gets the untampered
 *         # hash value of the string's text. this corresponds to MMA behavior.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_29user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_29user_hash = {"user_hash", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_6String_29user_hash, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_29user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_update = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("user_hash (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_update,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_update)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, 1); __PYX_ERR(0, 2987, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "user_hash") < 0)) __PYX_ERR(0, 2987, __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_update = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2987, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.String.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_28user_hash(__pyx_self, __pyx_v_self, __pyx_v_update);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_6String_28user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update) {
  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("user_hash", 0);

  /* "mathics/core/expression.py":2990
 *         # hashing a String is the one case where the user gets the untampered
 *         # hash value of the string's text. this corresponds to MMA behavior.
 *         update(self.value.encode("utf8"))             # <<<<<<<<<<<<<<
 * 
 *     def __getnewargs__(self):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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_n_u_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_u_utf8);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_INCREF(__pyx_v_update);
  __pyx_t_4 = __pyx_v_update; __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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2987
 *         return hash(("String", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # hashing a String is the one case where the user gets the untampered
 *         # hash value of the string's text. this corresponds to MMA behavior.
 */

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

/* "mathics/core/expression.py":2992
 *         update(self.value.encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_31__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_6String_31__getnewargs__ = {"__getnewargs__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_6String_31__getnewargs__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_6String_31__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getnewargs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_6String_30__getnewargs__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":2993
 * 
 *     def __getnewargs__(self):
 *         return (self.value,)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2993, __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_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2992
 *         update(self.value.encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */

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

/* "mathics/core/expression.py":2999
 *     value: str
 * 
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if type(value) in (bytes, bytearray):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, 1); __PYX_ERR(0, 2999, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 2999, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_cls = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2999, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom___new__(__pyx_self, __pyx_v_cls, __pyx_v_value);

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

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

  /* "mathics/core/expression.py":3000
 * 
 *     def __new__(cls, value):
 *         self = super().__new__(cls)             # <<<<<<<<<<<<<<
 *         if type(value) in (bytes, bytearray):
 *             self.value = value
 */
  __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 3000, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_cls);
  __Pyx_GIVEREF(__pyx_v_cls);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cls);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_cls) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_cls);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3001
 *     def __new__(cls, value):
 *         self = super().__new__(cls)
 *         if type(value) in (bytes, bytearray):             # <<<<<<<<<<<<<<
 *             self.value = value
 *         elif type(value) is list:
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_value)));
  __pyx_t_1 = ((PyObject *)Py_TYPE(__pyx_v_value));
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)(&PyBytes_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3001, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 3001, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)(&PyByteArray_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3001, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 3001, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/core/expression.py":3002
 *         self = super().__new__(cls)
 *         if type(value) in (bytes, bytearray):
 *             self.value = value             # <<<<<<<<<<<<<<
 *         elif type(value) is list:
 *             self.value = bytearray(list)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_v_value) < 0) __PYX_ERR(0, 3002, __pyx_L1_error)

    /* "mathics/core/expression.py":3001
 *     def __new__(cls, value):
 *         self = super().__new__(cls)
 *         if type(value) in (bytes, bytearray):             # <<<<<<<<<<<<<<
 *             self.value = value
 *         elif type(value) is list:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":3003
 *         if type(value) in (bytes, bytearray):
 *             self.value = value
 *         elif type(value) is list:             # <<<<<<<<<<<<<<
 *             self.value = bytearray(list)
 *         elif type(value) is str:
 */
  __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_value)) == ((PyObject *)(&PyList_Type)));
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "mathics/core/expression.py":3004
 *             self.value = value
 *         elif type(value) is list:
 *             self.value = bytearray(list)             # <<<<<<<<<<<<<<
 *         elif type(value) is str:
 *             self.value = base64.b64decode(value)
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyByteArray_Type)), ((PyObject *)(&PyList_Type))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_t_1) < 0) __PYX_ERR(0, 3004, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":3003
 *         if type(value) in (bytes, bytearray):
 *             self.value = value
 *         elif type(value) is list:             # <<<<<<<<<<<<<<
 *             self.value = bytearray(list)
 *         elif type(value) is str:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":3005
 *         elif type(value) is list:
 *             self.value = bytearray(list)
 *         elif type(value) is str:             # <<<<<<<<<<<<<<
 *             self.value = base64.b64decode(value)
 *         else:
 */
  __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_value)) == ((PyObject *)(&PyUnicode_Type)));
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (likely(__pyx_t_5)) {

    /* "mathics/core/expression.py":3006
 *             self.value = bytearray(list)
 *         elif type(value) is str:
 *             self.value = base64.b64decode(value)             # <<<<<<<<<<<<<<
 *         else:
 *             raise Exception("value does not belongs to a valid type")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_base64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3006, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_b64decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3006, __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 && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_value) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_value);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3006, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_t_1) < 0) __PYX_ERR(0, 3006, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":3005
 *         elif type(value) is list:
 *             self.value = bytearray(list)
 *         elif type(value) is str:             # <<<<<<<<<<<<<<
 *             self.value = base64.b64decode(value)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":3008
 *             self.value = base64.b64decode(value)
 *         else:
 *             raise Exception("value does not belongs to a valid type")             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__110, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3008, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3008, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":3009
 *         else:
 *             raise Exception("value does not belongs to a valid type")
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":2999
 *     value: str
 * 
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if type(value) in (bytes, bytearray):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3011
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return base64.b64encode(self.value).decode("utf8")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_3__str__ = {"__str__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_3__str__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_3__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_2__str__(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_2__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  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("__str__", 0);

  /* "mathics/core/expression.py":3012
 * 
 *     def __str__(self) -> str:
 *         return base64.b64encode(self.value).decode("utf8")             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_text(self, **options) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_base64); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_b64encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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, 3012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_n_u_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_u_utf8);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 3012, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3011
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return base64.b64encode(self.value).decode("utf8")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3014
 *         return base64.b64encode(self.value).decode("utf8")
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return '"' + self.__str__() + '"'
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_5boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_5boxes_to_text = {"boxes_to_text", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_5boxes_to_text, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_5boxes_to_text(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_text (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_text") < 0)) __PYX_ERR(0, 3014, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_text", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3014, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.boxes_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_4boxes_to_text(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_4boxes_to_text(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options) {
  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("boxes_to_text", 0);

  /* "mathics/core/expression.py":3015
 * 
 *     def boxes_to_text(self, **options) -> str:
 *         return '"' + self.__str__() + '"'             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_mathml(self, **options) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3015, __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, 3015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_kp_u__81, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_u__81); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 3015, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3014
 *         return base64.b64encode(self.value).decode("utf8")
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return '"' + self.__str__() + '"'
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.boxes_to_text", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3017
 *         return '"' + self.__str__() + '"'
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return encode_mathml(String('"' + self.__str__() + '"'))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_7boxes_to_mathml(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_7boxes_to_mathml = {"boxes_to_mathml", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_7boxes_to_mathml, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_7boxes_to_mathml(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_mathml (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_mathml") < 0)) __PYX_ERR(0, 3017, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_mathml", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3017, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.boxes_to_mathml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_6boxes_to_mathml(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_6boxes_to_mathml(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("boxes_to_mathml", 0);

  /* "mathics/core/expression.py":3018
 * 
 *     def boxes_to_mathml(self, **options) -> str:
 *         return encode_mathml(String('"' + self.__str__() + '"'))             # <<<<<<<<<<<<<<
 * 
 *     def boxes_to_tex(self, **options) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_mathml); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_String); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Add(__pyx_kp_u__81, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_kp_u__81); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_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, 3018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 3018, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3017
 *         return '"' + self.__str__() + '"'
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return encode_mathml(String('"' + self.__str__() + '"'))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.boxes_to_mathml", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3020
 *         return encode_mathml(String('"' + self.__str__() + '"'))
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return encode_tex(String('"' + self.__str__() + '"'))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_9boxes_to_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_9boxes_to_tex = {"boxes_to_tex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_9boxes_to_tex, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_9boxes_to_tex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("boxes_to_tex (wrapper)", 0);
  __pyx_v_options = PyDict_New(); if (unlikely(!__pyx_v_options)) return NULL;
  __Pyx_GOTREF(__pyx_v_options);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_options, values, pos_args, "boxes_to_tex") < 0)) __PYX_ERR(0, 3020, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("boxes_to_tex", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3020, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_options); __pyx_v_options = 0;
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.boxes_to_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_8boxes_to_tex(__pyx_self, __pyx_v_self, __pyx_v_options);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_8boxes_to_tex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_options) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("boxes_to_tex", 0);

  /* "mathics/core/expression.py":3021
 * 
 *     def boxes_to_tex(self, **options) -> str:
 *         return encode_tex(String('"' + self.__str__() + '"'))             # <<<<<<<<<<<<<<
 * 
 *     def atom_to_boxes(self, f, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_tex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_String); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Add(__pyx_kp_u__81, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_kp_u__81); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_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, 3021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 3021, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3020
 *         return encode_mathml(String('"' + self.__str__() + '"'))
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return encode_tex(String('"' + self.__str__() + '"'))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.boxes_to_tex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3023
 *         return encode_tex(String('"' + self.__str__() + '"'))
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         res = String('""' + self.__str__() + '""')
 *         return res
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_11atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_11atom_to_boxes = {"atom_to_boxes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_11atom_to_boxes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_11atom_to_boxes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_f = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atom_to_boxes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_f,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 1); __PYX_ERR(0, 3023, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, 2); __PYX_ERR(0, 3023, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atom_to_boxes") < 0)) __PYX_ERR(0, 3023, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_f = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atom_to_boxes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3023, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_10atom_to_boxes(__pyx_self, __pyx_v_self, __pyx_v_f, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_10atom_to_boxes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("atom_to_boxes", 0);

  /* "mathics/core/expression.py":3024
 * 
 *     def atom_to_boxes(self, f, evaluation):
 *         res = String('""' + self.__str__() + '""')             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_String); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_str); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3024, __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, 3024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Add(__pyx_kp_u__111, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_kp_u__111); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_res = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3025
 *     def atom_to_boxes(self, f, evaluation):
 *         res = String('""' + self.__str__() + '""')
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def do_copy(self) -> "ByteArrayAtom":
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3023
 *         return encode_tex(String('"' + self.__str__() + '"'))
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         res = String('""' + self.__str__() + '""')
 *         return res
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.atom_to_boxes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3027
 *         return res
 * 
 *     def do_copy(self) -> "ByteArrayAtom":             # <<<<<<<<<<<<<<
 *         return ByteArrayAtom(self.value)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_13do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_13do_copy = {"do_copy", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_13do_copy, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_13do_copy(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("do_copy (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_12do_copy(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":3028
 * 
 *     def do_copy(self) -> "ByteArrayAtom":
 *         return ByteArrayAtom(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def default_format(self, evaluation, form) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ByteArrayAtom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3028, __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;

  /* "mathics/core/expression.py":3027
 *         return res
 * 
 *     def do_copy(self) -> "ByteArrayAtom":             # <<<<<<<<<<<<<<
 *         return ByteArrayAtom(self.value)
 * 
 */

  /* 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("mathics.core.expression.ByteArrayAtom.do_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3030
 *         return ByteArrayAtom(self.value)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value
 *         return '"' + value.__str__() + '"'
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_15default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_15default_format = {"default_format", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_15default_format, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_15default_format(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  CYTHON_UNUSED PyObject *__pyx_v_form = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default_format (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,&__pyx_n_s_form,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 1); __PYX_ERR(0, 3030, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_form)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, 2); __PYX_ERR(0, 3030, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_format") < 0)) __PYX_ERR(0, 3030, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_form = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("default_format", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3030, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_14default_format(__pyx_self, __pyx_v_self, __pyx_v_evaluation, __pyx_v_form);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_14default_format(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation, CYTHON_UNUSED PyObject *__pyx_v_form) {
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("default_format", 0);

  /* "mathics/core/expression.py":3031
 * 
 *     def default_format(self, evaluation, form) -> str:
 *         value = self.value             # <<<<<<<<<<<<<<
 *         return '"' + value.__str__() + '"'
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_value = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3032
 *     def default_format(self, evaluation, form) -> str:
 *         value = self.value
 *         return '"' + value.__str__() + '"'             # <<<<<<<<<<<<<<
 * 
 *     def get_sort_key(self, pattern_sort=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_value, __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3032, __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, 3032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_kp_u__81, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_kp_u__81); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 3032, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3030
 *         return ByteArrayAtom(self.value)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value
 *         return '"' + value.__str__() + '"'
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.default_format", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3034
 *         return '"' + value.__str__() + '"'
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_17get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_17get_sort_key = {"get_sort_key", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_17get_sort_key, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_17get_sort_key(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_pattern_sort = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_sort_key (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_pattern_sort,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pattern_sort);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_sort_key") < 0)) __PYX_ERR(0, 3034, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_pattern_sort = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_sort_key", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3034, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_16get_sort_key(__pyx_self, __pyx_v_self, __pyx_v_pattern_sort);

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

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

  /* "mathics/core/expression.py":3035
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pattern_sort); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3035, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":3036
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:
 *             return super().get_sort_key(True)             # <<<<<<<<<<<<<<
 *         else:
 *             return [0, 1, self.value, 0, 1]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_CyFunction_GetClassObj(__pyx_self);
    if (!__pyx_t_3) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 3036, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_sort_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_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, Py_True) : __Pyx_PyObject_CallOneArg(__pyx_t_4, Py_True);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":3035
 * 
 *     def get_sort_key(self, pattern_sort=False):
 *         if pattern_sort:             # <<<<<<<<<<<<<<
 *             return super().get_sort_key(True)
 *         else:
 */
  }

  /* "mathics/core/expression.py":3038
 *             return super().get_sort_key(True)
 *         else:
 *             return [0, 1, self.value, 0, 1]             # <<<<<<<<<<<<<<
 * 
 *     def sameQ(self, other) -> bool:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyList_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3038, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_1);
    __Pyx_GIVEREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyList_SET_ITEM(__pyx_t_4, 3, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyList_SET_ITEM(__pyx_t_4, 4, __pyx_int_1);
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":3034
 *         return '"' + value.__str__() + '"'
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.get_sort_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3040
 *             return [0, 1, self.value, 0, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         # FIX: check
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_19sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_4core_10expression_13ByteArrayAtom_18sameQ[] = "Mathics SameQ";
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_19sameQ = {"sameQ", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_19sameQ, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_4core_10expression_13ByteArrayAtom_18sameQ};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_19sameQ(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_other = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sameQ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,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_other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, 1); __PYX_ERR(0, 3040, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sameQ") < 0)) __PYX_ERR(0, 3040, __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_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sameQ", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3040, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_18sameQ(__pyx_self, __pyx_v_self, __pyx_v_other);

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

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

  /* "mathics/core/expression.py":3043
 *         """Mathics SameQ"""
 *         # FIX: check
 *         if isinstance(other, ByteArrayAtom):             # <<<<<<<<<<<<<<
 *             return self.value == other.value
 *         return False
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ByteArrayAtom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_other, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 3043, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":3044
 *         # FIX: check
 *         if isinstance(other, ByteArrayAtom):
 *             return self.value == other.value             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3044, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":3043
 *         """Mathics SameQ"""
 *         # FIX: check
 *         if isinstance(other, ByteArrayAtom):             # <<<<<<<<<<<<<<
 *             return self.value == other.value
 *         return False
 */
  }

  /* "mathics/core/expression.py":3045
 *         if isinstance(other, ByteArrayAtom):
 *             return self.value == other.value
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def get_string_value(self) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3040
 *             return [0, 1, self.value, 0, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         # FIX: check
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.sameQ", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3047
 *         return False
 * 
 *     def get_string_value(self) -> str:             # <<<<<<<<<<<<<<
 *         try:
 *             return self.value.decode("utf-8")
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_21get_string_value(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_21get_string_value = {"get_string_value", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_21get_string_value, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_21get_string_value(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_string_value (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_20get_string_value(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_20get_string_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  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("get_string_value", 0);

  /* "mathics/core/expression.py":3048
 * 
 *     def get_string_value(self) -> str:
 *         try:             # <<<<<<<<<<<<<<
 *             return self.value.decode("utf-8")
 *         except:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "mathics/core/expression.py":3049
 *     def get_string_value(self) -> str:
 *         try:
 *             return self.value.decode("utf-8")             # <<<<<<<<<<<<<<
 *         except:
 *             return None
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3049, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_decode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3049, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_kp_u_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_utf_8);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3049, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 3049, __pyx_L3_error)
      __pyx_r = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;

      /* "mathics/core/expression.py":3048
 * 
 *     def get_string_value(self) -> str:
 *         try:             # <<<<<<<<<<<<<<
 *             return self.value.decode("utf-8")
 *         except:
 */
    }
    __pyx_L3_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;

    /* "mathics/core/expression.py":3050
 *         try:
 *             return self.value.decode("utf-8")
 *         except:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.get_string_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) __PYX_ERR(0, 3050, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);

      /* "mathics/core/expression.py":3051
 *             return self.value.decode("utf-8")
 *         except:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def to_sympy(self, **kwargs):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }
    __pyx_L5_except_error:;

    /* "mathics/core/expression.py":3048
 * 
 *     def get_string_value(self) -> str:
 *         try:             # <<<<<<<<<<<<<<
 *             return self.value.decode("utf-8")
 *         except:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":3047
 *         return False
 * 
 *     def get_string_value(self) -> str:             # <<<<<<<<<<<<<<
 *         try:
 *             return self.value.decode("utf-8")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.get_string_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3053
 *             return None
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_23to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_23to_sympy = {"to_sympy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_23to_sympy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_23to_sympy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED 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("to_sympy (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,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 (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "to_sympy") < 0)) __PYX_ERR(0, 3053, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_sympy", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3053, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.to_sympy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_22to_sympy(__pyx_self, __pyx_v_self, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_22to_sympy(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("to_sympy", 0);

  /* "mathics/core/expression.py":3054
 * 
 *     def to_sympy(self, **kwargs):
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def to_python(self, *args, **kwargs) -> str:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":3053
 *             return None
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */

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

/* "mathics/core/expression.py":3056
 *         return None
 * 
 *     def to_python(self, *args, **kwargs) -> str:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_25to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_25to_python = {"to_python", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_25to_python, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_25to_python(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED 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("to_python (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_self,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_self)) != 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, "to_python") < 0)) __PYX_ERR(0, 3056, __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_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("to_python", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3056, __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("mathics.core.expression.ByteArrayAtom.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_24to_python(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_24to_python(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  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("to_python", 0);

  /* "mathics/core/expression.py":3057
 * 
 *     def to_python(self, *args, **kwargs) -> str:
 *         return self.value             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 3057, __pyx_L1_error)
  __pyx_r = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3056
 *         return None
 * 
 *     def to_python(self, *args, **kwargs) -> str:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3059
 *         return self.value
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("ByteArrayAtom", self.value))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_27__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_27__hash__ = {"__hash__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_27__hash__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_27__hash__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_26__hash__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":3060
 * 
 *     def __hash__(self):
 *         return hash(("ByteArrayAtom", self.value))             # <<<<<<<<<<<<<<
 * 
 *     def user_hash(self, update):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_u_ByteArrayAtom);
  __Pyx_GIVEREF(__pyx_n_u_ByteArrayAtom);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_ByteArrayAtom);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_3 = PyObject_Hash(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_hash_t)-1))) __PYX_ERR(0, 3060, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_FromHash_t(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3059
 *         return self.value
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("ByteArrayAtom", self.value))
 * 
 */

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

/* "mathics/core/expression.py":3062
 *         return hash(("ByteArrayAtom", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # hashing a String is the one case where the user gets the untampered
 *         # hash value of the string's text. this corresponds to MMA behavior.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_29user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_29user_hash = {"user_hash", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_29user_hash, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_29user_hash(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_update = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("user_hash (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_update,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_update)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, 1); __PYX_ERR(0, 3062, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "user_hash") < 0)) __PYX_ERR(0, 3062, __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_update = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("user_hash", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3062, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.ByteArrayAtom.user_hash", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_28user_hash(__pyx_self, __pyx_v_self, __pyx_v_update);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_28user_hash(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_update) {
  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("user_hash", 0);

  /* "mathics/core/expression.py":3065
 *         # hashing a String is the one case where the user gets the untampered
 *         # hash value of the string's text. this corresponds to MMA behavior.
 *         update(self.value)             # <<<<<<<<<<<<<<
 * 
 *     def __getnewargs__(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_update);
  __pyx_t_3 = __pyx_v_update; __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_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3062
 *         return hash(("ByteArrayAtom", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # hashing a String is the one case where the user gets the untampered
 *         # hash value of the string's text. this corresponds to MMA behavior.
 */

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

/* "mathics/core/expression.py":3067
 *         update(self.value)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_31__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_31__getnewargs__ = {"__getnewargs__", (PyCFunction)__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_31__getnewargs__, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_13ByteArrayAtom_31__getnewargs__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getnewargs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_13ByteArrayAtom_30__getnewargs__(__pyx_self, ((PyObject *)__pyx_v_self));

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

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

  /* "mathics/core/expression.py":3068
 * 
 *     def __getnewargs__(self):
 *         return (self.value,)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3068, __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_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3067
 *         update(self.value)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */

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

/* "mathics/core/expression.py":3072
 * 
 * class StringFromPython(String):
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls, value)
 *         if isinstance(value, sympy.NumberSymbol):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_16StringFromPython_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_16StringFromPython_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_16StringFromPython_1__new__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_16StringFromPython_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cls = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__new__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_value,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, 1); __PYX_ERR(0, 3072, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(0, 3072, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_cls = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__new__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3072, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.StringFromPython.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_16StringFromPython___new__(__pyx_self, __pyx_v_cls, __pyx_v_value);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_16StringFromPython___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_self = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__new__", 0);

  /* "mathics/core/expression.py":3073
 * class StringFromPython(String):
 *     def __new__(cls, value):
 *         self = super().__new__(cls, value)             # <<<<<<<<<<<<<<
 *         if isinstance(value, sympy.NumberSymbol):
 *             self.value = "sympy." + str(value)
 */
  __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 3073, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_cls);
  __Pyx_GIVEREF(__pyx_v_cls);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cls);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_new_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_cls, __pyx_v_value};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3073, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_cls, __pyx_v_value};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3073, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_cls);
    __Pyx_GIVEREF(__pyx_v_cls);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_cls);
    __Pyx_INCREF(__pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_value);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3074
 *     def __new__(cls, value):
 *         self = super().__new__(cls, value)
 *         if isinstance(value, sympy.NumberSymbol):             # <<<<<<<<<<<<<<
 *             self.value = "sympy." + str(value)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sympy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_NumberSymbol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = PyObject_IsInstance(__pyx_v_value, __pyx_t_3); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 3074, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "mathics/core/expression.py":3075
 *         self = super().__new__(cls, value)
 *         if isinstance(value, sympy.NumberSymbol):
 *             self.value = "sympy." + str(value)             # <<<<<<<<<<<<<<
 * 
 *         # Note that the test is done with math.inf first.
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_sympy_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_t_1) < 0) __PYX_ERR(0, 3075, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/core/expression.py":3074
 *     def __new__(cls, value):
 *         self = super().__new__(cls, value)
 *         if isinstance(value, sympy.NumberSymbol):             # <<<<<<<<<<<<<<
 *             self.value = "sympy." + str(value)
 * 
 */
  }

  /* "mathics/core/expression.py":3079
 *         # Note that the test is done with math.inf first.
 *         # This is to use float's ==, which may not strictly be necessary.
 *         if math.inf == value:             # <<<<<<<<<<<<<<
 *             self.value = "math.inf"
 *         return self
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_inf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_value, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3079, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3079, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "mathics/core/expression.py":3080
 *         # This is to use float's ==, which may not strictly be necessary.
 *         if math.inf == value:
 *             self.value = "math.inf"             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_kp_u_math_inf) < 0) __PYX_ERR(0, 3080, __pyx_L1_error)

    /* "mathics/core/expression.py":3079
 *         # Note that the test is done with math.inf first.
 *         # This is to use float's ==, which may not strictly be necessary.
 *         if math.inf == value:             # <<<<<<<<<<<<<<
 *             self.value = "math.inf"
 *         return self
 */
  }

  /* "mathics/core/expression.py":3081
 *         if math.inf == value:
 *             self.value = "math.inf"
 *         return self             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3072
 * 
 * class StringFromPython(String):
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls, value)
 *         if isinstance(value, sympy.NumberSymbol):
 */

  /* 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("mathics.core.expression.StringFromPython.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3084
 * 
 * 
 * def get_default_value(name, evaluation, k=None, n=None):             # <<<<<<<<<<<<<<
 *     pos = []
 *     if k is not None:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_25get_default_value(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_25get_default_value = {"get_default_value", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_25get_default_value, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_25get_default_value(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_v_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_default_value (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_evaluation,&__pyx_n_s_k,&__pyx_n_s_n,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_name)) != 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_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_default_value", 0, 2, 4, 1); __PYX_ERR(0, 3084, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k);
          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_n);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_default_value") < 0)) __PYX_ERR(0, 3084, __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_name = values[0];
    __pyx_v_evaluation = values[1];
    __pyx_v_k = values[2];
    __pyx_v_n = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_default_value", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3084, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.get_default_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_24get_default_value(__pyx_self, __pyx_v_name, __pyx_v_evaluation, __pyx_v_k, __pyx_v_n);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_24get_default_value(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_k, PyObject *__pyx_v_n) {
  PyObject *__pyx_v_pos = NULL;
  PyObject *__pyx_v_pos_len = NULL;
  PyObject *__pyx_v_defaultexpr = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_9genexpr41__pyx_v_index = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_default_value", 0);

  /* "mathics/core/expression.py":3085
 * 
 * def get_default_value(name, evaluation, k=None, n=None):
 *     pos = []             # <<<<<<<<<<<<<<
 *     if k is not None:
 *         pos.append(k)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_pos = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3086
 * def get_default_value(name, evaluation, k=None, n=None):
 *     pos = []
 *     if k is not None:             # <<<<<<<<<<<<<<
 *         pos.append(k)
 *     if n is not None:
 */
  __pyx_t_2 = (__pyx_v_k != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":3087
 *     pos = []
 *     if k is not None:
 *         pos.append(k)             # <<<<<<<<<<<<<<
 *     if n is not None:
 *         pos.append(n)
 */
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_pos, __pyx_v_k); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 3087, __pyx_L1_error)

    /* "mathics/core/expression.py":3086
 * def get_default_value(name, evaluation, k=None, n=None):
 *     pos = []
 *     if k is not None:             # <<<<<<<<<<<<<<
 *         pos.append(k)
 *     if n is not None:
 */
  }

  /* "mathics/core/expression.py":3088
 *     if k is not None:
 *         pos.append(k)
 *     if n is not None:             # <<<<<<<<<<<<<<
 *         pos.append(n)
 *     for pos_len in reversed(list(range(len(pos) + 1))):
 */
  __pyx_t_3 = (__pyx_v_n != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":3089
 *         pos.append(k)
 *     if n is not None:
 *         pos.append(n)             # <<<<<<<<<<<<<<
 *     for pos_len in reversed(list(range(len(pos) + 1))):
 *         # Try patterns from specific to general
 */
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_pos, __pyx_v_n); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 3089, __pyx_L1_error)

    /* "mathics/core/expression.py":3088
 *     if k is not None:
 *         pos.append(k)
 *     if n is not None:             # <<<<<<<<<<<<<<
 *         pos.append(n)
 *     for pos_len in reversed(list(range(len(pos) + 1))):
 */
  }

  /* "mathics/core/expression.py":3090
 *     if n is not None:
 *         pos.append(n)
 *     for pos_len in reversed(list(range(len(pos) + 1))):             # <<<<<<<<<<<<<<
 *         # Try patterns from specific to general
 *         defaultexpr = Expression(
 */
  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_pos); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3090, __pyx_L1_error)
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_5 + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PySequence_List(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_5 = PyList_GET_SIZE(__pyx_t_6) - 1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_5 < 0) break;
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_6)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5--; if (unlikely(0 < 0)) __PYX_ERR(0, 3090, __pyx_L1_error)
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_5); __pyx_t_5--; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_pos_len, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/core/expression.py":3092
 *     for pos_len in reversed(list(range(len(pos) + 1))):
 *         # Try patterns from specific to general
 *         defaultexpr = Expression(             # <<<<<<<<<<<<<<
 *             "Default", Symbol(name), *[Integer(index) for index in pos[:pos_len]]
 *         )
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);

    /* "mathics/core/expression.py":3093
 *         # Try patterns from specific to general
 *         defaultexpr = Expression(
 *             "Default", Symbol(name), *[Integer(index) for index in pos[:pos_len]]             # <<<<<<<<<<<<<<
 *         )
 *         result = evaluation.definitions.get_value(
 */
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(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_7 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_v_name) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_name);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "mathics/core/expression.py":3092
 *     for pos_len in reversed(list(range(len(pos) + 1))):
 *         # Try patterns from specific to general
 *         defaultexpr = Expression(             # <<<<<<<<<<<<<<
 *             "Default", Symbol(name), *[Integer(index) for index in pos[:pos_len]]
 *         )
 */
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_n_u_Default);
    __Pyx_GIVEREF(__pyx_n_u_Default);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_Default);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
    __pyx_t_7 = 0;
    { /* enter inner scope */

      /* "mathics/core/expression.py":3093
 *         # Try patterns from specific to general
 *         defaultexpr = Expression(
 *             "Default", Symbol(name), *[Integer(index) for index in pos[:pos_len]]             # <<<<<<<<<<<<<<
 *         )
 *         result = evaluation.definitions.get_value(
 */
      __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3093, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_pos_len);
      __pyx_t_9 = __pyx_v_pos_len;
      __pyx_t_2 = (__pyx_t_9 == Py_None);
      if (__pyx_t_2) {
        __pyx_t_10 = PY_SSIZE_T_MAX;
      } else {
        __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3093, __pyx_L9_error)
        __pyx_t_10 = __pyx_t_11;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyList_GetSlice(__pyx_v_pos, 0, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3093, __pyx_L9_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_12 = __pyx_t_9; __Pyx_INCREF(__pyx_t_12); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      for (;;) {
        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_12)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 3093, __pyx_L9_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_12, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3093, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
        __Pyx_XDECREF_SET(__pyx_9genexpr41__pyx_v_index, __pyx_t_9);
        __pyx_t_9 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_Integer); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 3093, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_14 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_13, function);
          }
        }
        __pyx_t_9 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_9genexpr41__pyx_v_index) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_9genexpr41__pyx_v_index);
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3093, __pyx_L9_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_7, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 3093, __pyx_L9_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_9genexpr41__pyx_v_index); __pyx_9genexpr41__pyx_v_index = 0;
      goto __pyx_L12_exit_scope;
      __pyx_L9_error:;
      __Pyx_XDECREF(__pyx_9genexpr41__pyx_v_index); __pyx_9genexpr41__pyx_v_index = 0;
      goto __pyx_L1_error;
      __pyx_L12_exit_scope:;
    } /* exit inner scope */

    /* "mathics/core/expression.py":3092
 *     for pos_len in reversed(list(range(len(pos) + 1))):
 *         # Try patterns from specific to general
 *         defaultexpr = Expression(             # <<<<<<<<<<<<<<
 *             "Default", Symbol(name), *[Integer(index) for index in pos[:pos_len]]
 *         )
 */
    __pyx_t_12 = PySequence_Tuple(__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_defaultexpr, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "mathics/core/expression.py":3095
 *             "Default", Symbol(name), *[Integer(index) for index in pos[:pos_len]]
 *         )
 *         result = evaluation.definitions.get_value(             # <<<<<<<<<<<<<<
 *             name, "System`DefaultValues", defaultexpr, evaluation
 *         )
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_get_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3095, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "mathics/core/expression.py":3096
 *         )
 *         result = evaluation.definitions.get_value(
 *             name, "System`DefaultValues", defaultexpr, evaluation             # <<<<<<<<<<<<<<
 *         )
 *         if result is not None:
 */
    __pyx_t_7 = NULL;
    __pyx_t_15 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_15 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_name, __pyx_kp_u_System_DefaultValues, __pyx_v_defaultexpr, __pyx_v_evaluation};
      __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_15, 4+__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3095, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_12);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_name, __pyx_kp_u_System_DefaultValues, __pyx_v_defaultexpr, __pyx_v_evaluation};
      __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_15, 4+__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3095, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_12);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(4+__pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3095, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_15, __pyx_v_name);
      __Pyx_INCREF(__pyx_kp_u_System_DefaultValues);
      __Pyx_GIVEREF(__pyx_kp_u_System_DefaultValues);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_15, __pyx_kp_u_System_DefaultValues);
      __Pyx_INCREF(__pyx_v_defaultexpr);
      __Pyx_GIVEREF(__pyx_v_defaultexpr);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_15, __pyx_v_defaultexpr);
      __Pyx_INCREF(__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_15, __pyx_v_evaluation);
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3095, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_result, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "mathics/core/expression.py":3098
 *             name, "System`DefaultValues", defaultexpr, evaluation
 *         )
 *         if result is not None:             # <<<<<<<<<<<<<<
 *             if result.sameQ(defaultexpr):
 *                 result = result.evaluate(evaluation)
 */
    __pyx_t_2 = (__pyx_v_result != Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {

      /* "mathics/core/expression.py":3099
 *         )
 *         if result is not None:
 *             if result.sameQ(defaultexpr):             # <<<<<<<<<<<<<<
 *                 result = result.evaluate(evaluation)
 *             return result
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3099, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_12 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_v_defaultexpr) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_defaultexpr);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3099, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 3099, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_3) {

        /* "mathics/core/expression.py":3100
 *         if result is not None:
 *             if result.sameQ(defaultexpr):
 *                 result = result.evaluate(evaluation)             # <<<<<<<<<<<<<<
 *             return result
 *     return None
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3100, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_12 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_8, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_evaluation);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3100, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_12);
        __pyx_t_12 = 0;

        /* "mathics/core/expression.py":3099
 *         )
 *         if result is not None:
 *             if result.sameQ(defaultexpr):             # <<<<<<<<<<<<<<
 *                 result = result.evaluate(evaluation)
 *             return result
 */
      }

      /* "mathics/core/expression.py":3101
 *             if result.sameQ(defaultexpr):
 *                 result = result.evaluate(evaluation)
 *             return result             # <<<<<<<<<<<<<<
 *     return None
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "mathics/core/expression.py":3098
 *             name, "System`DefaultValues", defaultexpr, evaluation
 *         )
 *         if result is not None:             # <<<<<<<<<<<<<<
 *             if result.sameQ(defaultexpr):
 *                 result = result.evaluate(evaluation)
 */
    }

    /* "mathics/core/expression.py":3090
 *     if n is not None:
 *         pos.append(n)
 *     for pos_len in reversed(list(range(len(pos) + 1))):             # <<<<<<<<<<<<<<
 *         # Try patterns from specific to general
 *         defaultexpr = Expression(
 */
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":3102
 *                 result = result.evaluate(evaluation)
 *             return result
 *     return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/core/expression.py":3084
 * 
 * 
 * def get_default_value(name, evaluation, k=None, n=None):             # <<<<<<<<<<<<<<
 *     pos = []
 *     if k is not None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("mathics.core.expression.get_default_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pos);
  __Pyx_XDECREF(__pyx_v_pos_len);
  __Pyx_XDECREF(__pyx_v_defaultexpr);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_9genexpr41__pyx_v_index);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3105
 * 
 * 
 * def print_parenthesizes(             # <<<<<<<<<<<<<<
 *     precedence, outer_precedence=None, parenthesize_when_equal=False
 * ) -> bool:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_27print_parenthesizes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_27print_parenthesizes = {"print_parenthesizes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_27print_parenthesizes, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_27print_parenthesizes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_precedence = 0;
  PyObject *__pyx_v_outer_precedence = 0;
  PyObject *__pyx_v_parenthesize_when_equal = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_parenthesizes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precedence,&__pyx_n_s_outer_precedence,&__pyx_n_s_parenthesize_when_equal,0};
    PyObject* values[3] = {0,0,0};

    /* "mathics/core/expression.py":3106
 * 
 * def print_parenthesizes(
 *     precedence, outer_precedence=None, parenthesize_when_equal=False             # <<<<<<<<<<<<<<
 * ) -> bool:
 *     return outer_precedence is not None and (
 */
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)Py_False));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_precedence)) != 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_outer_precedence);
          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_parenthesize_when_equal);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "print_parenthesizes") < 0)) __PYX_ERR(0, 3105, __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_precedence = values[0];
    __pyx_v_outer_precedence = values[1];
    __pyx_v_parenthesize_when_equal = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("print_parenthesizes", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3105, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.print_parenthesizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_26print_parenthesizes(__pyx_self, __pyx_v_precedence, __pyx_v_outer_precedence, __pyx_v_parenthesize_when_equal);

  /* "mathics/core/expression.py":3105
 * 
 * 
 * def print_parenthesizes(             # <<<<<<<<<<<<<<
 *     precedence, outer_precedence=None, parenthesize_when_equal=False
 * ) -> bool:
 */

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

static PyObject *__pyx_pf_7mathics_4core_10expression_26print_parenthesizes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_precedence, PyObject *__pyx_v_outer_precedence, PyObject *__pyx_v_parenthesize_when_equal) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("print_parenthesizes", 0);

  /* "mathics/core/expression.py":3108
 *     precedence, outer_precedence=None, parenthesize_when_equal=False
 * ) -> bool:
 *     return outer_precedence is not None and (             # <<<<<<<<<<<<<<
 *         outer_precedence > precedence
 *         or (outer_precedence == precedence and parenthesize_when_equal)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_outer_precedence != Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":3109
 * ) -> bool:
 *     return outer_precedence is not None and (
 *         outer_precedence > precedence             # <<<<<<<<<<<<<<
 *         or (outer_precedence == precedence and parenthesize_when_equal)
 *     )
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_outer_precedence, __pyx_v_precedence, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3109, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3109, __pyx_L1_error)
  if (!__pyx_t_2) {
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }

  /* "mathics/core/expression.py":3110
 *     return outer_precedence is not None and (
 *         outer_precedence > precedence
 *         or (outer_precedence == precedence and parenthesize_when_equal)             # <<<<<<<<<<<<<<
 *     )
 * 
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_outer_precedence, __pyx_v_precedence, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3110, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3110, __pyx_L1_error)
  if (__pyx_t_2) {
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3_bool_binop_done;
  }
  __Pyx_INCREF(__pyx_v_parenthesize_when_equal);
  __pyx_t_1 = __pyx_v_parenthesize_when_equal;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3105
 * 
 * 
 * def print_parenthesizes(             # <<<<<<<<<<<<<<
 *     precedence, outer_precedence=None, parenthesize_when_equal=False
 * ) -> bool:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.print_parenthesizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3114
 * 
 * 
 * def _is_neutral_symbol(symbol_name, cache, evaluation):             # <<<<<<<<<<<<<<
 *     # a symbol is neutral if it does not invoke any rules, but is sure to make its Expression stay
 *     # the way it is (e.g. List[1, 2, 3] will always stay List[1, 2, 3], so long as nobody defines
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_29_is_neutral_symbol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_29_is_neutral_symbol = {"_is_neutral_symbol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_29_is_neutral_symbol, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_29_is_neutral_symbol(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_symbol_name = 0;
  PyObject *__pyx_v_cache = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_is_neutral_symbol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_symbol_name,&__pyx_n_s_cache_2,&__pyx_n_s_evaluation,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_symbol_name)) != 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_cache_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_is_neutral_symbol", 1, 3, 3, 1); __PYX_ERR(0, 3114, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_is_neutral_symbol", 1, 3, 3, 2); __PYX_ERR(0, 3114, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_is_neutral_symbol") < 0)) __PYX_ERR(0, 3114, __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_symbol_name = values[0];
    __pyx_v_cache = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_is_neutral_symbol", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3114, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression._is_neutral_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_28_is_neutral_symbol(__pyx_self, __pyx_v_symbol_name, __pyx_v_cache, __pyx_v_evaluation);

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

/* "mathics/core/expression.py":3131
 *     else:
 *         r = all(
 *             len(definition.get_values_list(x)) == 0             # <<<<<<<<<<<<<<
 *             for x in ("up", "sub", "down", "own")
 *         )
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_18_is_neutral_symbol_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_31_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_31_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3131, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *) __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_7mathics_4core_10expression_18_is_neutral_symbol_2generator14, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_is_neutral_symbol_locals_genexp, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 3131, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression._is_neutral_symbol.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_7mathics_4core_10expression_18_is_neutral_symbol_2generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_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;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3131, __pyx_L1_error)

  /* "mathics/core/expression.py":3132
 *         r = all(
 *             len(definition.get_values_list(x)) == 0
 *             for x in ("up", "sub", "down", "own")             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_1 = __pyx_tuple__112; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= 4) 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, 3132, __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, 3132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, ((PyObject*)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":3131
 *     else:
 *         r = all(
 *             len(definition.get_values_list(x)) == 0             # <<<<<<<<<<<<<<
 *             for x in ("up", "sub", "down", "own")
 *         )
 */
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_definition)) { __Pyx_RaiseClosureNameError("definition"); __PYX_ERR(0, 3131, __pyx_L1_error) }
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_definition, __pyx_n_s_get_values_list); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3131, __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_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_cur_scope->__pyx_v_x) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_cur_scope->__pyx_v_x);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3131, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = ((!((__pyx_t_6 == 0) != 0)) != 0);
    if (__pyx_t_7) {

      /* "mathics/core/expression.py":3130
 *         r = True
 *     else:
 *         r = all(             # <<<<<<<<<<<<<<
 *             len(definition.get_values_list(x)) == 0
 *             for x in ("up", "sub", "down", "own")
 */
      __Pyx_XDECREF(__pyx_r);

      /* "mathics/core/expression.py":3131
 *     else:
 *         r = all(
 *             len(definition.get_values_list(x)) == 0             # <<<<<<<<<<<<<<
 *             for x in ("up", "sub", "down", "own")
 *         )
 */
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }

    /* "mathics/core/expression.py":3132
 *         r = all(
 *             len(definition.get_values_list(x)) == 0
 *             for x in ("up", "sub", "down", "own")             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  }
  /*else*/ {

    /* "mathics/core/expression.py":3130
 *         r = True
 *     else:
 *         r = all(             # <<<<<<<<<<<<<<
 *             len(definition.get_values_list(x)) == 0
 *             for x in ("up", "sub", "down", "own")
 */
    __Pyx_XDECREF(__pyx_r);

    /* "mathics/core/expression.py":3131
 *     else:
 *         r = all(
 *             len(definition.get_values_list(x)) == 0             # <<<<<<<<<<<<<<
 *             for x in ("up", "sub", "down", "own")
 *         )
 */
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":3132
 *         r = all(
 *             len(definition.get_values_list(x)) == 0
 *             for x in ("up", "sub", "down", "own")             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "mathics/core/expression.py":3131
 *     else:
 *         r = all(
 *             len(definition.get_values_list(x)) == 0             # <<<<<<<<<<<<<<
 *             for x in ("up", "sub", "down", "own")
 *         )
 */

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

/* "mathics/core/expression.py":3114
 * 
 * 
 * def _is_neutral_symbol(symbol_name, cache, evaluation):             # <<<<<<<<<<<<<<
 *     # a symbol is neutral if it does not invoke any rules, but is sure to make its Expression stay
 *     # the way it is (e.g. List[1, 2, 3] will always stay List[1, 2, 3], so long as nobody defines
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_28_is_neutral_symbol(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_symbol_name, PyObject *__pyx_v_cache, PyObject *__pyx_v_evaluation) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *__pyx_cur_scope;
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_v_definitions = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_neutral_symbol", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3114, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }

  /* "mathics/core/expression.py":3119
 *     # a rule on this).
 * 
 *     if cache:             # <<<<<<<<<<<<<<
 *         r = cache.get(symbol_name)
 *         if r is not None:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_cache); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3119, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":3120
 * 
 *     if cache:
 *         r = cache.get(symbol_name)             # <<<<<<<<<<<<<<
 *         if r is not None:
 *             return r
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_symbol_name) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_symbol_name);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3120, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_r = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":3121
 *     if cache:
 *         r = cache.get(symbol_name)
 *         if r is not None:             # <<<<<<<<<<<<<<
 *             return r
 * 
 */
    __pyx_t_1 = (__pyx_v_r != Py_None);
    __pyx_t_5 = (__pyx_t_1 != 0);
    if (__pyx_t_5) {

      /* "mathics/core/expression.py":3122
 *         r = cache.get(symbol_name)
 *         if r is not None:
 *             return r             # <<<<<<<<<<<<<<
 * 
 *     definitions = evaluation.definitions
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_r);
      __pyx_r = __pyx_v_r;
      goto __pyx_L0;

      /* "mathics/core/expression.py":3121
 *     if cache:
 *         r = cache.get(symbol_name)
 *         if r is not None:             # <<<<<<<<<<<<<<
 *             return r
 * 
 */
    }

    /* "mathics/core/expression.py":3119
 *     # a rule on this).
 * 
 *     if cache:             # <<<<<<<<<<<<<<
 *         r = cache.get(symbol_name)
 *         if r is not None:
 */
  }

  /* "mathics/core/expression.py":3124
 *             return r
 * 
 *     definitions = evaluation.definitions             # <<<<<<<<<<<<<<
 * 
 *     definition = definitions.get_definition(symbol_name, only_if_exists=True)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_definitions = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3126
 *     definitions = evaluation.definitions
 * 
 *     definition = definitions.get_definition(symbol_name, only_if_exists=True)             # <<<<<<<<<<<<<<
 *     if definition is None:
 *         r = True
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_definitions, __pyx_n_s_get_definition); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_symbol_name);
  __Pyx_GIVEREF(__pyx_v_symbol_name);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_symbol_name);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_only_if_exists, Py_True) < 0) __PYX_ERR(0, 3126, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_cur_scope->__pyx_v_definition = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "mathics/core/expression.py":3127
 * 
 *     definition = definitions.get_definition(symbol_name, only_if_exists=True)
 *     if definition is None:             # <<<<<<<<<<<<<<
 *         r = True
 *     else:
 */
  __pyx_t_5 = (__pyx_cur_scope->__pyx_v_definition == Py_None);
  __pyx_t_1 = (__pyx_t_5 != 0);
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":3128
 *     definition = definitions.get_definition(symbol_name, only_if_exists=True)
 *     if definition is None:
 *         r = True             # <<<<<<<<<<<<<<
 *     else:
 *         r = all(
 */
    __Pyx_INCREF(Py_True);
    __Pyx_XDECREF_SET(__pyx_v_r, Py_True);

    /* "mathics/core/expression.py":3127
 * 
 *     definition = definitions.get_definition(symbol_name, only_if_exists=True)
 *     if definition is None:             # <<<<<<<<<<<<<<
 *         r = True
 *     else:
 */
    goto __pyx_L5;
  }

  /* "mathics/core/expression.py":3130
 *         r = True
 *     else:
 *         r = all(             # <<<<<<<<<<<<<<
 *             len(definition.get_values_list(x)) == 0
 *             for x in ("up", "sub", "down", "own")
 */
  /*else*/ {

    /* "mathics/core/expression.py":3131
 *     else:
 *         r = all(
 *             len(definition.get_values_list(x)) == 0             # <<<<<<<<<<<<<<
 *             for x in ("up", "sub", "down", "own")
 *         )
 */
    __pyx_t_6 = __pyx_pf_7mathics_4core_10expression_18_is_neutral_symbol_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_Generator_Next(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L5:;

  /* "mathics/core/expression.py":3135
 *         )
 * 
 *     if cache:             # <<<<<<<<<<<<<<
 *         cache[symbol_name] = r
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_cache); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3135, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":3136
 * 
 *     if cache:
 *         cache[symbol_name] = r             # <<<<<<<<<<<<<<
 * 
 *     return r
 */
    if (unlikely(PyObject_SetItem(__pyx_v_cache, __pyx_v_symbol_name, __pyx_v_r) < 0)) __PYX_ERR(0, 3136, __pyx_L1_error)

    /* "mathics/core/expression.py":3135
 *         )
 * 
 *     if cache:             # <<<<<<<<<<<<<<
 *         cache[symbol_name] = r
 * 
 */
  }

  /* "mathics/core/expression.py":3138
 *         cache[symbol_name] = r
 * 
 *     return r             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_r);
  __pyx_r = __pyx_v_r;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3114
 * 
 * 
 * def _is_neutral_symbol(symbol_name, cache, evaluation):             # <<<<<<<<<<<<<<
 *     # a symbol is neutral if it does not invoke any rules, but is sure to make its Expression stay
 *     # the way it is (e.g. List[1, 2, 3] will always stay List[1, 2, 3], so long as nobody defines
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression._is_neutral_symbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_definitions);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3141
 * 
 * 
 * def _is_neutral_head(head, cache, evaluation):             # <<<<<<<<<<<<<<
 *     if not isinstance(head, Symbol):
 *         return False
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_31_is_neutral_head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_31_is_neutral_head = {"_is_neutral_head", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_31_is_neutral_head, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_31_is_neutral_head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_head = 0;
  PyObject *__pyx_v_cache = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_is_neutral_head (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_head,&__pyx_n_s_cache_2,&__pyx_n_s_evaluation,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_head)) != 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_cache_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_is_neutral_head", 1, 3, 3, 1); __PYX_ERR(0, 3141, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_is_neutral_head", 1, 3, 3, 2); __PYX_ERR(0, 3141, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_is_neutral_head") < 0)) __PYX_ERR(0, 3141, __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_head = values[0];
    __pyx_v_cache = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_is_neutral_head", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3141, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression._is_neutral_head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_30_is_neutral_head(__pyx_self, __pyx_v_head, __pyx_v_cache, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_30_is_neutral_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_head, PyObject *__pyx_v_cache, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_is_neutral_head", 0);

  /* "mathics/core/expression.py":3142
 * 
 * def _is_neutral_head(head, cache, evaluation):
 *     if not isinstance(head, Symbol):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_head, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 3142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_3) {

    /* "mathics/core/expression.py":3143
 * def _is_neutral_head(head, cache, evaluation):
 *     if not isinstance(head, Symbol):
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     return _is_neutral_symbol(head.get_name(), cache, evaluation)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "mathics/core/expression.py":3142
 * 
 * def _is_neutral_head(head, cache, evaluation):
 *     if not isinstance(head, Symbol):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  }

  /* "mathics/core/expression.py":3145
 *         return False
 * 
 *     return _is_neutral_symbol(head.get_name(), cache, evaluation)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_is_neutral_symbol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_head, __pyx_n_s_get_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_8 = 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_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_5, __pyx_v_cache, __pyx_v_evaluation};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3145, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_5, __pyx_v_cache, __pyx_v_evaluation};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3145, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_cache);
    __Pyx_GIVEREF(__pyx_v_cache);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_v_cache);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_evaluation);
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3145, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3141
 * 
 * 
 * def _is_neutral_head(head, cache, evaluation):             # <<<<<<<<<<<<<<
 *     if not isinstance(head, Symbol):
 *         return False
 */

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

/* "mathics/core/expression.py":3156
 * 
 * class Structure(object):
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         # create an Expression with the given list "leaves" as leaves.
 *         # NOTE: the caller guarantees that "leaves" only contains items that are from "origins".
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_9Structure_1__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_9Structure_1__call__ = {"__call__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_9Structure_1__call__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_9Structure_1__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_leaves = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_leaves,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_leaves)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); __PYX_ERR(0, 3156, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 3156, __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_leaves = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3156, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Structure.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_9Structure___call__(__pyx_self, __pyx_v_self, __pyx_v_leaves);

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

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

  /* "mathics/core/expression.py":3159
 *         # create an Expression with the given list "leaves" as leaves.
 *         # NOTE: the caller guarantees that "leaves" only contains items that are from "origins".
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def filter(self, expr, cond):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 3159, __pyx_L1_error)

  /* "mathics/core/expression.py":3156
 * 
 * class Structure(object):
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         # create an Expression with the given list "leaves" as leaves.
 *         # NOTE: the caller guarantees that "leaves" only contains items that are from "origins".
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Structure.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3161
 *         raise NotImplementedError
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         # create an Expression with a subset of "expr".leaves (picked out by the filter "cond").
 *         # NOTE: the caller guarantees that "expr" is from "origins".
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_9Structure_3filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_9Structure_3filter = {"filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_9Structure_3filter, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_9Structure_3filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_expr = 0;
  CYTHON_UNUSED PyObject *__pyx_v_cond = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_cond,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter", 1, 3, 3, 1); __PYX_ERR(0, 3161, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cond)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter", 1, 3, 3, 2); __PYX_ERR(0, 3161, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filter") < 0)) __PYX_ERR(0, 3161, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_cond = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3161, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Structure.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_9Structure_2filter(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_cond);

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

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

  /* "mathics/core/expression.py":3164
 *         # create an Expression with a subset of "expr".leaves (picked out by the filter "cond").
 *         # NOTE: the caller guarantees that "expr" is from "origins".
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def slice(self, expr, py_slice):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 3164, __pyx_L1_error)

  /* "mathics/core/expression.py":3161
 *         raise NotImplementedError
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         # create an Expression with a subset of "expr".leaves (picked out by the filter "cond").
 *         # NOTE: the caller guarantees that "expr" is from "origins".
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Structure.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3166
 *         raise NotImplementedError
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         # create an Expression, using the given slice of "expr".leaves as leaves.
 *         # NOTE: the caller guarantees that "expr" is from "origins".
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_9Structure_5slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_9Structure_5slice = {"slice", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_9Structure_5slice, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_9Structure_5slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_expr = 0;
  CYTHON_UNUSED PyObject *__pyx_v_py_slice = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("slice (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_py_slice,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slice", 1, 3, 3, 1); __PYX_ERR(0, 3166, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_slice)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slice", 1, 3, 3, 2); __PYX_ERR(0, 3166, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "slice") < 0)) __PYX_ERR(0, 3166, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_py_slice = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("slice", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3166, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.Structure.slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_9Structure_4slice(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_py_slice);

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

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

  /* "mathics/core/expression.py":3169
 *         # create an Expression, using the given slice of "expr".leaves as leaves.
 *         # NOTE: the caller guarantees that "expr" is from "origins".
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 3169, __pyx_L1_error)

  /* "mathics/core/expression.py":3166
 *         raise NotImplementedError
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         # create an Expression, using the given slice of "expr".leaves as leaves.
 *         # NOTE: the caller guarantees that "expr" is from "origins".
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.Structure.slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3177
 * 
 * class UnlinkedStructure(Structure):
 *     def __init__(self, head):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = None
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_17UnlinkedStructure_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_head = 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_head,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_head)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 3177, __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, 3177, __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_head = 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, 3177, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.UnlinkedStructure.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_17UnlinkedStructure___init__(__pyx_self, __pyx_v_self, __pyx_v_head);

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

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

  /* "mathics/core/expression.py":3178
 * class UnlinkedStructure(Structure):
 *     def __init__(self, head):
 *         self._head = head             # <<<<<<<<<<<<<<
 *         self._cache = None
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_head_2, __pyx_v_head) < 0) __PYX_ERR(0, 3178, __pyx_L1_error)

  /* "mathics/core/expression.py":3179
 *     def __init__(self, head):
 *         self._head = head
 *         self._cache = None             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, leaves):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cache, Py_None) < 0) __PYX_ERR(0, 3179, __pyx_L1_error)

  /* "mathics/core/expression.py":3177
 * 
 * class UnlinkedStructure(Structure):
 *     def __init__(self, head):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = None
 */

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

/* "mathics/core/expression.py":3181
 *         self._cache = None
 * 
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_3__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_17UnlinkedStructure_3__call__ = {"__call__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_3__call__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_3__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_leaves = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_leaves,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_leaves)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); __PYX_ERR(0, 3181, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 3181, __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_leaves = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3181, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.UnlinkedStructure.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_17UnlinkedStructure_2__call__(__pyx_self, __pyx_v_self, __pyx_v_leaves);

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

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

  /* "mathics/core/expression.py":3182
 * 
 *     def __call__(self, leaves):
 *         expr = Expression(self._head)             # <<<<<<<<<<<<<<
 *         expr._leaves = tuple(leaves)
 *         return expr
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_expr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3183
 *     def __call__(self, leaves):
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)             # <<<<<<<<<<<<<<
 *         return expr
 * 
 */
  __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2, __pyx_t_1) < 0) __PYX_ERR(0, 3183, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3184
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)
 *         return expr             # <<<<<<<<<<<<<<
 * 
 *     def filter(self, expr, cond):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3181
 *         self._cache = None
 * 
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)
 */

  /* 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("mathics.core.expression.UnlinkedStructure.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3186
 *         return expr
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_5filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_17UnlinkedStructure_5filter = {"filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_5filter, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_5filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_cond = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_cond,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter", 1, 3, 3, 1); __PYX_ERR(0, 3186, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cond)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter", 1, 3, 3, 2); __PYX_ERR(0, 3186, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filter") < 0)) __PYX_ERR(0, 3186, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_cond = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3186, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.UnlinkedStructure.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_17UnlinkedStructure_4filter(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_cond);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_17UnlinkedStructure_4filter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_cond) {
  PyObject *__pyx_9genexpr43__pyx_v_leaf = 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;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter", 0);

  /* "mathics/core/expression.py":3187
 * 
 *     def filter(self, expr, cond):
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])             # <<<<<<<<<<<<<<
 * 
 *     def slice(self, expr, py_slice):
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3187, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3187, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3187, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3187, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 3187, __pyx_L5_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3187, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 3187, __pyx_L5_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3187, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 3187, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr43__pyx_v_leaf, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_INCREF(__pyx_v_cond);
      __pyx_t_7 = __pyx_v_cond; __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_9genexpr43__pyx_v_leaf) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_9genexpr43__pyx_v_leaf);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3187, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 3187, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_9) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_9genexpr43__pyx_v_leaf))) __PYX_ERR(0, 3187, __pyx_L5_error)
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_9genexpr43__pyx_v_leaf); __pyx_9genexpr43__pyx_v_leaf = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr43__pyx_v_leaf); __pyx_9genexpr43__pyx_v_leaf = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __Pyx_INCREF(__pyx_v_self);
  __pyx_t_4 = __pyx_v_self; __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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3186
 *         return expr
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.core.expression.UnlinkedStructure.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_9genexpr43__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3189
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_7slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_17UnlinkedStructure_7slice = {"slice", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_7slice, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_17UnlinkedStructure_7slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_py_slice = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("slice (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_py_slice,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slice", 1, 3, 3, 1); __PYX_ERR(0, 3189, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_slice)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slice", 1, 3, 3, 2); __PYX_ERR(0, 3189, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "slice") < 0)) __PYX_ERR(0, 3189, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_py_slice = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("slice", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3189, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.UnlinkedStructure.slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_17UnlinkedStructure_6slice(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_py_slice);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_17UnlinkedStructure_6slice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_py_slice) {
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_v_lower = NULL;
  PyObject *__pyx_v_upper = NULL;
  PyObject *__pyx_v_step = 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 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("slice", 0);

  /* "mathics/core/expression.py":3190
 * 
 *     def slice(self, expr, py_slice):
 *         leaves = expr._leaves             # <<<<<<<<<<<<<<
 *         lower, upper, step = py_slice.indices(len(leaves))
 *         if step != 1:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_leaves = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3191
 *     def slice(self, expr, py_slice):
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))             # <<<<<<<<<<<<<<
 *         if step != 1:
 *             raise ValueError("Structure.slice only supports slice steps of 1")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_slice, __pyx_n_s_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Length(__pyx_v_leaves); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3191, __pyx_L1_error)
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3191, __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 != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3191, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 3191, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3191, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_lower = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_upper = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_step = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "mathics/core/expression.py":3192
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 *         if step != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError("Structure.slice only supports slice steps of 1")
 *         return self(leaves[lower:upper])
 */
  __pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_v_step, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_8)) {

    /* "mathics/core/expression.py":3193
 *         lower, upper, step = py_slice.indices(len(leaves))
 *         if step != 1:
 *             raise ValueError("Structure.slice only supports slice steps of 1")             # <<<<<<<<<<<<<<
 *         return self(leaves[lower:upper])
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__113, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3193, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3193, __pyx_L1_error)

    /* "mathics/core/expression.py":3192
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 *         if step != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError("Structure.slice only supports slice steps of 1")
 *         return self(leaves[lower:upper])
 */
  }

  /* "mathics/core/expression.py":3194
 *         if step != 1:
 *             raise ValueError("Structure.slice only supports slice steps of 1")
 *         return self(leaves[lower:upper])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_leaves, 0, 0, &__pyx_v_lower, &__pyx_v_upper, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_self);
  __pyx_t_4 = __pyx_v_self; __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3189
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.UnlinkedStructure.slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_v_lower);
  __Pyx_XDECREF(__pyx_v_upper);
  __Pyx_XDECREF(__pyx_v_step);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3203
 * 
 * class LinkedStructure(Structure):
 *     def __init__(self, head, cache):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = cache
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_15LinkedStructure_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_15LinkedStructure_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_15LinkedStructure_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_15LinkedStructure_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_head = 0;
  PyObject *__pyx_v_cache = 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_head,&__pyx_n_s_cache_2,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_head)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 3203, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cache_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 3203, __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, 3203, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_head = values[1];
    __pyx_v_cache = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3203, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.LinkedStructure.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_15LinkedStructure___init__(__pyx_self, __pyx_v_self, __pyx_v_head, __pyx_v_cache);

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

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

  /* "mathics/core/expression.py":3204
 * class LinkedStructure(Structure):
 *     def __init__(self, head, cache):
 *         self._head = head             # <<<<<<<<<<<<<<
 *         self._cache = cache
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_head_2, __pyx_v_head) < 0) __PYX_ERR(0, 3204, __pyx_L1_error)

  /* "mathics/core/expression.py":3205
 *     def __init__(self, head, cache):
 *         self._head = head
 *         self._cache = cache             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, leaves):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cache, __pyx_v_cache) < 0) __PYX_ERR(0, 3205, __pyx_L1_error)

  /* "mathics/core/expression.py":3203
 * 
 * class LinkedStructure(Structure):
 *     def __init__(self, head, cache):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = cache
 */

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

/* "mathics/core/expression.py":3207
 *         self._cache = cache
 * 
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_15LinkedStructure_3__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_15LinkedStructure_3__call__ = {"__call__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_15LinkedStructure_3__call__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_15LinkedStructure_3__call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_leaves = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_leaves,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_leaves)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); __PYX_ERR(0, 3207, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(0, 3207, __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_leaves = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3207, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.LinkedStructure.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_15LinkedStructure_2__call__(__pyx_self, __pyx_v_self, __pyx_v_leaves);

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

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

  /* "mathics/core/expression.py":3208
 * 
 *     def __call__(self, leaves):
 *         expr = Expression(self._head)             # <<<<<<<<<<<<<<
 *         expr._leaves = tuple(leaves)
 *         expr._cache = self._cache.reordered()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_expr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3209
 *     def __call__(self, leaves):
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)             # <<<<<<<<<<<<<<
 *         expr._cache = self._cache.reordered()
 *         return expr
 */
  __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2, __pyx_t_1) < 0) __PYX_ERR(0, 3209, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3210
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)
 *         expr._cache = self._cache.reordered()             # <<<<<<<<<<<<<<
 *         return expr
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_reordered); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_cache, __pyx_t_1) < 0) __PYX_ERR(0, 3210, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3211
 *         expr._leaves = tuple(leaves)
 *         expr._cache = self._cache.reordered()
 *         return expr             # <<<<<<<<<<<<<<
 * 
 *     def filter(self, expr, cond):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3207
 *         self._cache = cache
 * 
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)
 */

  /* 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("mathics.core.expression.LinkedStructure.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3213
 *         return expr
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_15LinkedStructure_5filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_15LinkedStructure_5filter = {"filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_15LinkedStructure_5filter, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_15LinkedStructure_5filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_cond = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_cond,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter", 1, 3, 3, 1); __PYX_ERR(0, 3213, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cond)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filter", 1, 3, 3, 2); __PYX_ERR(0, 3213, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filter") < 0)) __PYX_ERR(0, 3213, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_cond = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3213, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.LinkedStructure.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_15LinkedStructure_4filter(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_cond);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_15LinkedStructure_4filter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_cond) {
  PyObject *__pyx_9genexpr44__pyx_v_leaf = 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;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("filter", 0);

  /* "mathics/core/expression.py":3214
 * 
 *     def filter(self, expr, cond):
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])             # <<<<<<<<<<<<<<
 * 
 *     def slice(self, expr, py_slice):
 */
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3214, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3214, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3214, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3214, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 3214, __pyx_L5_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3214, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 3214, __pyx_L5_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3214, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_6(__pyx_t_4);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 3214, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_9genexpr44__pyx_v_leaf, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_INCREF(__pyx_v_cond);
      __pyx_t_7 = __pyx_v_cond; __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_9genexpr44__pyx_v_leaf) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_9genexpr44__pyx_v_leaf);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3214, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 3214, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_9) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_9genexpr44__pyx_v_leaf))) __PYX_ERR(0, 3214, __pyx_L5_error)
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_9genexpr44__pyx_v_leaf); __pyx_9genexpr44__pyx_v_leaf = 0;
    goto __pyx_L9_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr44__pyx_v_leaf); __pyx_9genexpr44__pyx_v_leaf = 0;
    goto __pyx_L1_error;
    __pyx_L9_exit_scope:;
  } /* exit inner scope */
  __Pyx_INCREF(__pyx_v_self);
  __pyx_t_4 = __pyx_v_self; __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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3213
 *         return expr
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.core.expression.LinkedStructure.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_9genexpr44__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3216
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_15LinkedStructure_7slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_15LinkedStructure_7slice = {"slice", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_15LinkedStructure_7slice, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_15LinkedStructure_7slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_py_slice = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("slice (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_py_slice,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slice", 1, 3, 3, 1); __PYX_ERR(0, 3216, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_slice)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("slice", 1, 3, 3, 2); __PYX_ERR(0, 3216, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "slice") < 0)) __PYX_ERR(0, 3216, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_py_slice = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("slice", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3216, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.LinkedStructure.slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_15LinkedStructure_6slice(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_py_slice);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_15LinkedStructure_6slice(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_py_slice) {
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_v_lower = NULL;
  PyObject *__pyx_v_upper = NULL;
  PyObject *__pyx_v_step = NULL;
  PyObject *__pyx_v_new = 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 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("slice", 0);

  /* "mathics/core/expression.py":3217
 * 
 *     def slice(self, expr, py_slice):
 *         leaves = expr._leaves             # <<<<<<<<<<<<<<
 *         lower, upper, step = py_slice.indices(len(leaves))
 *         if step != 1:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_leaves = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3218
 *     def slice(self, expr, py_slice):
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))             # <<<<<<<<<<<<<<
 *         if step != 1:
 *             raise ValueError("Structure.slice only supports slice steps of 1")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_slice, __pyx_n_s_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Length(__pyx_v_leaves); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3218, __pyx_L1_error)
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3218, __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 != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 3218, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 3218, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 3218, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_lower = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_upper = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_step = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "mathics/core/expression.py":3219
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 *         if step != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError("Structure.slice only supports slice steps of 1")
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_v_step, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3219, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_8)) {

    /* "mathics/core/expression.py":3220
 *         lower, upper, step = py_slice.indices(len(leaves))
 *         if step != 1:
 *             raise ValueError("Structure.slice only supports slice steps of 1")             # <<<<<<<<<<<<<<
 * 
 *         new = Expression(self._head)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__113, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 3220, __pyx_L1_error)

    /* "mathics/core/expression.py":3219
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 *         if step != 1:             # <<<<<<<<<<<<<<
 *             raise ValueError("Structure.slice only supports slice steps of 1")
 * 
 */
  }

  /* "mathics/core/expression.py":3222
 *             raise ValueError("Structure.slice only supports slice steps of 1")
 * 
 *         new = Expression(self._head)             # <<<<<<<<<<<<<<
 *         new._leaves = tuple(leaves[lower:upper])
 *         if expr._cache:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Expression); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_head_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_new = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3223
 * 
 *         new = Expression(self._head)
 *         new._leaves = tuple(leaves[lower:upper])             # <<<<<<<<<<<<<<
 *         if expr._cache:
 *             new._cache = expr._cache.sliced(lower, upper)
 */
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_leaves, 0, 0, &__pyx_v_lower, &__pyx_v_upper, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_new, __pyx_n_s_leaves_2, __pyx_t_5) < 0) __PYX_ERR(0, 3223, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":3224
 *         new = Expression(self._head)
 *         new._leaves = tuple(leaves[lower:upper])
 *         if expr._cache:             # <<<<<<<<<<<<<<
 *             new._cache = expr._cache.sliced(lower, upper)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_cache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3224, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_8) {

    /* "mathics/core/expression.py":3225
 *         new._leaves = tuple(leaves[lower:upper])
 *         if expr._cache:
 *             new._cache = expr._cache.sliced(lower, upper)             # <<<<<<<<<<<<<<
 * 
 *         return new
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sliced); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3225, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_lower, __pyx_v_upper};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3225, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_lower, __pyx_v_upper};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3225, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3225, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_v_lower);
      __Pyx_GIVEREF(__pyx_v_lower);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_lower);
      __Pyx_INCREF(__pyx_v_upper);
      __Pyx_GIVEREF(__pyx_v_upper);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_v_upper);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3225, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_new, __pyx_n_s_cache, __pyx_t_5) < 0) __PYX_ERR(0, 3225, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "mathics/core/expression.py":3224
 *         new = Expression(self._head)
 *         new._leaves = tuple(leaves[lower:upper])
 *         if expr._cache:             # <<<<<<<<<<<<<<
 *             new._cache = expr._cache.sliced(lower, upper)
 * 
 */
  }

  /* "mathics/core/expression.py":3227
 *             new._cache = expr._cache.sliced(lower, upper)
 * 
 *         return new             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_new);
  __pyx_r = __pyx_v_new;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3216
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.core.expression.LinkedStructure.slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_v_lower);
  __Pyx_XDECREF(__pyx_v_upper);
  __Pyx_XDECREF(__pyx_v_step);
  __Pyx_XDECREF(__pyx_v_new);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3230
 * 
 * 
 * def structure(head, origins, evaluation, structure_cache=None):             # <<<<<<<<<<<<<<
 *     # creates a Structure for building Expressions with head "head" and leaves
 *     # originating (exlusively) from "origins" (leaves are passed into the functions
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_33structure(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_33structure = {"structure", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_33structure, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_33structure(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_head = 0;
  PyObject *__pyx_v_origins = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_structure_cache = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("structure (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_head,&__pyx_n_s_origins,&__pyx_n_s_evaluation,&__pyx_n_s_structure_cache,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_head)) != 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_origins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("structure", 0, 3, 4, 1); __PYX_ERR(0, 3230, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("structure", 0, 3, 4, 2); __PYX_ERR(0, 3230, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_structure_cache);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "structure") < 0)) __PYX_ERR(0, 3230, __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);
        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_head = values[0];
    __pyx_v_origins = values[1];
    __pyx_v_evaluation = values[2];
    __pyx_v_structure_cache = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("structure", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3230, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.structure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_32structure(__pyx_self, __pyx_v_head, __pyx_v_origins, __pyx_v_evaluation, __pyx_v_structure_cache);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_32structure(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_head, PyObject *__pyx_v_origins, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_structure_cache) {
  PyObject *__pyx_v_cache = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("structure", 0);
  __Pyx_INCREF(__pyx_v_head);

  /* "mathics/core/expression.py":3240
 *     # must originate from one of the listed Expressions).
 * 
 *     if isinstance(head, (str,)):             # <<<<<<<<<<<<<<
 *         head = Symbol(head)
 * 
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_head); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "mathics/core/expression.py":3241
 * 
 *     if isinstance(head, (str,)):
 *         head = Symbol(head)             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(origins, (Expression, Structure)):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_head);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_head, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":3240
 *     # must originate from one of the listed Expressions).
 * 
 *     if isinstance(head, (str,)):             # <<<<<<<<<<<<<<
 *         head = Symbol(head)
 * 
 */
  }

  /* "mathics/core/expression.py":3243
 *         head = Symbol(head)
 * 
 *     if isinstance(origins, (Expression, Structure)):             # <<<<<<<<<<<<<<
 *         cache = origins._cache
 *         if cache is not None and not _is_neutral_head(
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Structure); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_IsInstance(__pyx_v_origins, __pyx_t_3); 
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_2 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = PyObject_IsInstance(__pyx_v_origins, __pyx_t_4); 
  __pyx_t_1 = (__pyx_t_6 != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":3244
 * 
 *     if isinstance(origins, (Expression, Structure)):
 *         cache = origins._cache             # <<<<<<<<<<<<<<
 *         if cache is not None and not _is_neutral_head(
 *             head, structure_cache, evaluation
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_origins, __pyx_n_s_cache); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_cache = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":3245
 *     if isinstance(origins, (Expression, Structure)):
 *         cache = origins._cache
 *         if cache is not None and not _is_neutral_head(             # <<<<<<<<<<<<<<
 *             head, structure_cache, evaluation
 *         ):
 */
    __pyx_t_2 = (__pyx_v_cache != Py_None);
    __pyx_t_6 = (__pyx_t_2 != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L8_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_is_neutral_head); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "mathics/core/expression.py":3246
 *         cache = origins._cache
 *         if cache is not None and not _is_neutral_head(
 *             head, structure_cache, evaluation             # <<<<<<<<<<<<<<
 *         ):
 *             cache = None
 */
    __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[4] = {__pyx_t_5, __pyx_v_head, __pyx_v_structure_cache, __pyx_v_evaluation};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3245, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_head, __pyx_v_structure_cache, __pyx_v_evaluation};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3245, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_head);
      __Pyx_GIVEREF(__pyx_v_head);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_head);
      __Pyx_INCREF(__pyx_v_structure_cache);
      __Pyx_GIVEREF(__pyx_v_structure_cache);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_structure_cache);
      __Pyx_INCREF(__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_evaluation);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "mathics/core/expression.py":3245
 *     if isinstance(origins, (Expression, Structure)):
 *         cache = origins._cache
 *         if cache is not None and not _is_neutral_head(             # <<<<<<<<<<<<<<
 *             head, structure_cache, evaluation
 *         ):
 */
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 3245, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = ((!__pyx_t_6) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_1) {

      /* "mathics/core/expression.py":3248
 *             head, structure_cache, evaluation
 *         ):
 *             cache = None             # <<<<<<<<<<<<<<
 *     elif isinstance(origins, (list, tuple)):
 *         if _is_neutral_head(head, structure_cache, evaluation):
 */
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_cache, Py_None);

      /* "mathics/core/expression.py":3245
 *     if isinstance(origins, (Expression, Structure)):
 *         cache = origins._cache
 *         if cache is not None and not _is_neutral_head(             # <<<<<<<<<<<<<<
 *             head, structure_cache, evaluation
 *         ):
 */
    }

    /* "mathics/core/expression.py":3243
 *         head = Symbol(head)
 * 
 *     if isinstance(origins, (Expression, Structure)):             # <<<<<<<<<<<<<<
 *         cache = origins._cache
 *         if cache is not None and not _is_neutral_head(
 */
    goto __pyx_L4;
  }

  /* "mathics/core/expression.py":3249
 *         ):
 *             cache = None
 *     elif isinstance(origins, (list, tuple)):             # <<<<<<<<<<<<<<
 *         if _is_neutral_head(head, structure_cache, evaluation):
 *             cache = ExpressionCache.union(origins, evaluation)
 */
  __pyx_t_2 = PyList_Check(__pyx_v_origins); 
  __pyx_t_6 = (__pyx_t_2 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_6 = PyTuple_Check(__pyx_v_origins); 
  __pyx_t_2 = (__pyx_t_6 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L10_bool_binop_done:;
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (likely(__pyx_t_2)) {

    /* "mathics/core/expression.py":3250
 *             cache = None
 *     elif isinstance(origins, (list, tuple)):
 *         if _is_neutral_head(head, structure_cache, evaluation):             # <<<<<<<<<<<<<<
 *             cache = ExpressionCache.union(origins, evaluation)
 *         else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_is_neutral_head); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_head, __pyx_v_structure_cache, __pyx_v_evaluation};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3250, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_v_head, __pyx_v_structure_cache, __pyx_v_evaluation};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3250, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_v_head);
      __Pyx_GIVEREF(__pyx_v_head);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_head);
      __Pyx_INCREF(__pyx_v_structure_cache);
      __Pyx_GIVEREF(__pyx_v_structure_cache);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_structure_cache);
      __Pyx_INCREF(__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_evaluation);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3250, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 3250, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "mathics/core/expression.py":3251
 *     elif isinstance(origins, (list, tuple)):
 *         if _is_neutral_head(head, structure_cache, evaluation):
 *             cache = ExpressionCache.union(origins, evaluation)             # <<<<<<<<<<<<<<
 *         else:
 *             cache = None
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ExpressionCache); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_union); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(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_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_origins, __pyx_v_evaluation};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3251, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_origins, __pyx_v_evaluation};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3251, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3251, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_origins);
        __Pyx_GIVEREF(__pyx_v_origins);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_origins);
        __Pyx_INCREF(__pyx_v_evaluation);
        __Pyx_GIVEREF(__pyx_v_evaluation);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_evaluation);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3251, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_cache = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "mathics/core/expression.py":3250
 *             cache = None
 *     elif isinstance(origins, (list, tuple)):
 *         if _is_neutral_head(head, structure_cache, evaluation):             # <<<<<<<<<<<<<<
 *             cache = ExpressionCache.union(origins, evaluation)
 *         else:
 */
      goto __pyx_L12;
    }

    /* "mathics/core/expression.py":3253
 *             cache = ExpressionCache.union(origins, evaluation)
 *         else:
 *             cache = None             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError("expected Expression, Structure, tuple or list as orig param")
 */
    /*else*/ {
      __Pyx_INCREF(Py_None);
      __pyx_v_cache = Py_None;
    }
    __pyx_L12:;

    /* "mathics/core/expression.py":3249
 *         ):
 *             cache = None
 *     elif isinstance(origins, (list, tuple)):             # <<<<<<<<<<<<<<
 *         if _is_neutral_head(head, structure_cache, evaluation):
 *             cache = ExpressionCache.union(origins, evaluation)
 */
    goto __pyx_L4;
  }

  /* "mathics/core/expression.py":3255
 *             cache = None
 *     else:
 *         raise ValueError("expected Expression, Structure, tuple or list as orig param")             # <<<<<<<<<<<<<<
 * 
 *     if cache is None:
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__114, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3255, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 3255, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "mathics/core/expression.py":3257
 *         raise ValueError("expected Expression, Structure, tuple or list as orig param")
 * 
 *     if cache is None:             # <<<<<<<<<<<<<<
 *         return UnlinkedStructure(head)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_cache == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":3258
 * 
 *     if cache is None:
 *         return UnlinkedStructure(head)             # <<<<<<<<<<<<<<
 *     else:
 *         return LinkedStructure(head, cache)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_UnlinkedStructure); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_head);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/core/expression.py":3257
 *         raise ValueError("expected Expression, Structure, tuple or list as orig param")
 * 
 *     if cache is None:             # <<<<<<<<<<<<<<
 *         return UnlinkedStructure(head)
 *     else:
 */
  }

  /* "mathics/core/expression.py":3260
 *         return UnlinkedStructure(head)
 *     else:
 *         return LinkedStructure(head, cache)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_LinkedStructure); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3260, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_head, __pyx_v_cache};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3260, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_head, __pyx_v_cache};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3260, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_8) {
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = NULL;
      }
      __Pyx_INCREF(__pyx_v_head);
      __Pyx_GIVEREF(__pyx_v_head);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_v_head);
      __Pyx_INCREF(__pyx_v_cache);
      __Pyx_GIVEREF(__pyx_v_cache);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_v_cache);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "mathics/core/expression.py":3230
 * 
 * 
 * def structure(head, origins, evaluation, structure_cache=None):             # <<<<<<<<<<<<<<
 *     # creates a Structure for building Expressions with head "head" and leaves
 *     # originating (exlusively) from "origins" (leaves are passed into the functions
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.core.expression.structure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cache);
  __Pyx_XDECREF(__pyx_v_head);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3263
 * 
 * 
 * def atom_list_constructor(evaluation, head, *atom_names):             # <<<<<<<<<<<<<<
 *     # if we encounter an Expression that consists wholly of atoms and those atoms (and the
 *     # expression's head) have no rules associated with them, we can speed up evaluation.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_35atom_list_constructor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_35atom_list_constructor = {"atom_list_constructor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_35atom_list_constructor, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_35atom_list_constructor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_head = 0;
  PyObject *__pyx_v_atom_names = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atom_list_constructor (wrapper)", 0);
  if (PyTuple_GET_SIZE(__pyx_args) > 2) {
    __pyx_v_atom_names = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_atom_names)) {
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_atom_names);
  } else {
    __pyx_v_atom_names = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_evaluation,&__pyx_n_s_head,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_evaluation)) != 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_head)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("atom_list_constructor", 0, 2, 2, 1); __PYX_ERR(0, 3263, __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, 0, values, used_pos_args, "atom_list_constructor") < 0)) __PYX_ERR(0, 3263, __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_evaluation = values[0];
    __pyx_v_head = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atom_list_constructor", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3263, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_CLEAR(__pyx_v_atom_names);
  __Pyx_AddTraceback("mathics.core.expression.atom_list_constructor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_34atom_list_constructor(__pyx_self, __pyx_v_evaluation, __pyx_v_head, __pyx_v_atom_names);

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

/* "mathics/core/expression.py":3286
 *     if optimize:
 * 
 *         def construct(leaves):             # <<<<<<<<<<<<<<
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_21atom_list_constructor_1construct(PyObject *__pyx_self, PyObject *__pyx_v_leaves); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_21atom_list_constructor_1construct = {"construct", (PyCFunction)__pyx_pw_7mathics_4core_10expression_21atom_list_constructor_1construct, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_21atom_list_constructor_1construct(PyObject *__pyx_self, PyObject *__pyx_v_leaves) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("construct (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_21atom_list_constructor_construct(__pyx_self, ((PyObject *)__pyx_v_leaves));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_21atom_list_constructor_construct(PyObject *__pyx_self, PyObject *__pyx_v_leaves) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *__pyx_cur_scope;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *__pyx_outer_scope;
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_v_sym = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("construct", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/core/expression.py":3287
 * 
 *         def construct(leaves):
 *             expr = Expression(head)             # <<<<<<<<<<<<<<
 *             expr._leaves = list(leaves)
 *             sym = set(chain([head.get_name()], full_atom_names))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_head)) { __Pyx_RaiseClosureNameError("head"); __PYX_ERR(0, 3287, __pyx_L1_error) }
  __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_cur_scope->__pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_head);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_expr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3288
 *         def construct(leaves):
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)             # <<<<<<<<<<<<<<
 *             sym = set(chain([head.get_name()], full_atom_names))
 *             expr._cache = ExpressionCache(evaluation.definitions.now, sym, None)
 */
  __pyx_t_1 = PySequence_List(__pyx_v_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2, __pyx_t_1) < 0) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3289
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)
 *             sym = set(chain([head.get_name()], full_atom_names))             # <<<<<<<<<<<<<<
 *             expr._cache = ExpressionCache(evaluation.definitions.now, sym, None)
 *             return expr
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_chain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_head)) { __Pyx_RaiseClosureNameError("head"); __PYX_ERR(0, 3289, __pyx_L1_error) }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_head, __pyx_n_s_get_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3289, __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, 3289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_full_atom_names)) { __Pyx_RaiseClosureNameError("full_atom_names"); __PYX_ERR(0, 3289, __pyx_L1_error) }
  __pyx_t_3 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_cur_scope->__pyx_v_full_atom_names};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3289, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_cur_scope->__pyx_v_full_atom_names};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3289, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3289, __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_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_full_atom_names);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_full_atom_names);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_full_atom_names);
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3289, __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_t_2 = PySet_New(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sym = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3290
 *             expr._leaves = list(leaves)
 *             sym = set(chain([head.get_name()], full_atom_names))
 *             expr._cache = ExpressionCache(evaluation.definitions.now, sym, None)             # <<<<<<<<<<<<<<
 *             return expr
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ExpressionCache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(!__pyx_cur_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 3290, __pyx_L1_error) }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_now); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_4, __pyx_v_sym, Py_None};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3290, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_4, __pyx_v_sym, Py_None};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3290, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_sym);
    __Pyx_GIVEREF(__pyx_v_sym);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_sym);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, Py_None);
    __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3290, __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 (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_cache, __pyx_t_2) < 0) __PYX_ERR(0, 3290, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3291
 *             sym = set(chain([head.get_name()], full_atom_names))
 *             expr._cache = ExpressionCache(evaluation.definitions.now, sym, None)
 *             return expr             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3286
 *     if optimize:
 * 
 *         def construct(leaves):             # <<<<<<<<<<<<<<
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.core.expression.atom_list_constructor.construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_sym);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3295
 *     else:
 * 
 *         def construct(leaves):             # <<<<<<<<<<<<<<
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_21atom_list_constructor_3construct(PyObject *__pyx_self, PyObject *__pyx_v_leaves); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_21atom_list_constructor_3construct = {"construct", (PyCFunction)__pyx_pw_7mathics_4core_10expression_21atom_list_constructor_3construct, METH_O, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_21atom_list_constructor_3construct(PyObject *__pyx_self, PyObject *__pyx_v_leaves) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("construct (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_4core_10expression_21atom_list_constructor_2construct(__pyx_self, ((PyObject *)__pyx_v_leaves));

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

static PyObject *__pyx_pf_7mathics_4core_10expression_21atom_list_constructor_2construct(PyObject *__pyx_self, PyObject *__pyx_v_leaves) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *__pyx_cur_scope;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *__pyx_outer_scope;
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("construct", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/core/expression.py":3296
 * 
 *         def construct(leaves):
 *             expr = Expression(head)             # <<<<<<<<<<<<<<
 *             expr._leaves = list(leaves)
 *             return expr
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_head)) { __Pyx_RaiseClosureNameError("head"); __PYX_ERR(0, 3296, __pyx_L1_error) }
  __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_cur_scope->__pyx_v_head) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_head);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_expr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3297
 *         def construct(leaves):
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)             # <<<<<<<<<<<<<<
 *             return expr
 * 
 */
  __pyx_t_1 = PySequence_List(__pyx_v_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_expr, __pyx_n_s_leaves_2, __pyx_t_1) < 0) __PYX_ERR(0, 3297, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3298
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)
 *             return expr             # <<<<<<<<<<<<<<
 * 
 *     return construct
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3295
 *     else:
 * 
 *         def construct(leaves):             # <<<<<<<<<<<<<<
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.core.expression.atom_list_constructor.construct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_4core_10expression_21atom_list_constructor_6generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/core/expression.py":3271
 * 
 *     if not _is_neutral_head(head, None, evaluation) or any(
 *         not atom for atom in atom_names             # <<<<<<<<<<<<<<
 *     ):
 *         optimize = False
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_21atom_list_constructor_4genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_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_7mathics_4core_10expression___pyx_scope_struct_33_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_33_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_33_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3271, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *) __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_7mathics_4core_10expression_21atom_list_constructor_6generator15, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_atom_list_constructor_locals_gen, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 3271, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.atom_list_constructor.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_7mathics_4core_10expression_21atom_list_constructor_6generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3271, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_atom_names)) { __Pyx_RaiseClosureNameError("atom_names"); __PYX_ERR(0, 3271, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_atom_names == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 3271, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_atom_names; __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, 3271, __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, 3271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_atom);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_atom, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_atom); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 3271, __pyx_L1_error)
    __pyx_t_5 = ((!__pyx_t_4) != 0);
    if (__pyx_t_5) {

      /* "mathics/core/expression.py":3270
 *     # long as the evaluation's Definitions are guaranteed to not change.
 * 
 *     if not _is_neutral_head(head, None, evaluation) or any(             # <<<<<<<<<<<<<<
 *         not atom for atom in atom_names
 *     ):
 */
      __Pyx_XDECREF(__pyx_r);

      /* "mathics/core/expression.py":3271
 * 
 *     if not _is_neutral_head(head, None, evaluation) or any(
 *         not atom for atom in atom_names             # <<<<<<<<<<<<<<
 *     ):
 *         optimize = False
 */
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {

    /* "mathics/core/expression.py":3270
 *     # long as the evaluation's Definitions are guaranteed to not change.
 * 
 *     if not _is_neutral_head(head, None, evaluation) or any(             # <<<<<<<<<<<<<<
 *         not atom for atom in atom_names
 *     ):
 */
    __Pyx_XDECREF(__pyx_r);

    /* "mathics/core/expression.py":3271
 * 
 *     if not _is_neutral_head(head, None, evaluation) or any(
 *         not atom for atom in atom_names             # <<<<<<<<<<<<<<
 *     ):
 *         optimize = False
 */
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_4core_10expression_21atom_list_constructor_9generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/core/expression.py":3278
 * 
 *         if not all(
 *             _is_neutral_symbol(atom, None, evaluation) for atom in full_atom_names             # <<<<<<<<<<<<<<
 *         ):
 *             optimize = False
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_21atom_list_constructor_7genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_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_7mathics_4core_10expression___pyx_scope_struct_34_genexpr *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_34_genexpr(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_34_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3278, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *) __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_7mathics_4core_10expression_21atom_list_constructor_9generator16, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_atom_list_constructor_locals_gen, __pyx_n_s_mathics_core_expression); if (unlikely(!gen)) __PYX_ERR(0, 3278, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.core.expression.atom_list_constructor.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_7mathics_4core_10expression_21atom_list_constructor_9generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3278, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_full_atom_names)) { __Pyx_RaiseClosureNameError("full_atom_names"); __PYX_ERR(0, 3278, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_full_atom_names == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 3278, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_full_atom_names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 3278, __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, 3278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_atom);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_atom, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_is_neutral_symbol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 3278, __pyx_L1_error) }
    __pyx_t_5 = NULL;
    __pyx_t_6 = 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_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_atom, Py_None, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3278, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_atom, Py_None, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3278, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_atom);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_atom);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_atom);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, Py_None);
      __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3278, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = ((!__pyx_t_8) != 0);
    if (__pyx_t_9) {

      /* "mathics/core/expression.py":3277
 *         full_atom_names = [ensure_context(atom) for atom in atom_names]
 * 
 *         if not all(             # <<<<<<<<<<<<<<
 *             _is_neutral_symbol(atom, None, evaluation) for atom in full_atom_names
 *         ):
 */
      __Pyx_XDECREF(__pyx_r);

      /* "mathics/core/expression.py":3278
 * 
 *         if not all(
 *             _is_neutral_symbol(atom, None, evaluation) for atom in full_atom_names             # <<<<<<<<<<<<<<
 *         ):
 *             optimize = False
 */
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {

    /* "mathics/core/expression.py":3277
 *         full_atom_names = [ensure_context(atom) for atom in atom_names]
 * 
 *         if not all(             # <<<<<<<<<<<<<<
 *             _is_neutral_symbol(atom, None, evaluation) for atom in full_atom_names
 *         ):
 */
    __Pyx_XDECREF(__pyx_r);

    /* "mathics/core/expression.py":3278
 * 
 *         if not all(
 *             _is_neutral_symbol(atom, None, evaluation) for atom in full_atom_names             # <<<<<<<<<<<<<<
 *         ):
 *             optimize = False
 */
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

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

/* "mathics/core/expression.py":3263
 * 
 * 
 * def atom_list_constructor(evaluation, head, *atom_names):             # <<<<<<<<<<<<<<
 *     # if we encounter an Expression that consists wholly of atoms and those atoms (and the
 *     # expression's head) have no rules associated with them, we can speed up evaluation.
 */

static PyObject *__pyx_pf_7mathics_4core_10expression_34atom_list_constructor(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_head, PyObject *__pyx_v_atom_names) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *__pyx_cur_scope;
  int __pyx_v_optimize;
  PyObject *__pyx_v_construct = 0;
  PyObject *__pyx_9genexpr46__pyx_v_atom = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("atom_list_constructor", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *)__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor(__pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3263, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_evaluation = __pyx_v_evaluation;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
  __pyx_cur_scope->__pyx_v_head = __pyx_v_head;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_head);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_head);
  __pyx_cur_scope->__pyx_v_atom_names = __pyx_v_atom_names;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_atom_names);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_atom_names);

  /* "mathics/core/expression.py":3270
 *     # long as the evaluation's Definitions are guaranteed to not change.
 * 
 *     if not _is_neutral_head(head, None, evaluation) or any(             # <<<<<<<<<<<<<<
 *         not atom for atom in atom_names
 *     ):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_is_neutral_head); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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[4] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_head, Py_None, __pyx_cur_scope->__pyx_v_evaluation};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3270, __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[4] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_head, Py_None, __pyx_cur_scope->__pyx_v_evaluation};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3270, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3270, __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_cur_scope->__pyx_v_head);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_head);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_cur_scope->__pyx_v_head);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, Py_None);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_cur_scope->__pyx_v_evaluation);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3270, __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_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 3270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = ((!__pyx_t_7) != 0);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_1 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }

  /* "mathics/core/expression.py":3271
 * 
 *     if not _is_neutral_head(head, None, evaluation) or any(
 *         not atom for atom in atom_names             # <<<<<<<<<<<<<<
 *     ):
 *         optimize = False
 */
  __pyx_t_2 = __pyx_pf_7mathics_4core_10expression_21atom_list_constructor_4genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Generator_Next(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 3271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;

  /* "mathics/core/expression.py":3270
 *     # long as the evaluation's Definitions are guaranteed to not change.
 * 
 *     if not _is_neutral_head(head, None, evaluation) or any(             # <<<<<<<<<<<<<<
 *         not atom for atom in atom_names
 *     ):
 */
  if (__pyx_t_1) {

    /* "mathics/core/expression.py":3273
 *         not atom for atom in atom_names
 *     ):
 *         optimize = False             # <<<<<<<<<<<<<<
 *     else:
 *         full_atom_names = [ensure_context(atom) for atom in atom_names]
 */
    __pyx_v_optimize = 0;

    /* "mathics/core/expression.py":3270
 *     # long as the evaluation's Definitions are guaranteed to not change.
 * 
 *     if not _is_neutral_head(head, None, evaluation) or any(             # <<<<<<<<<<<<<<
 *         not atom for atom in atom_names
 *     ):
 */
    goto __pyx_L3;
  }

  /* "mathics/core/expression.py":3275
 *         optimize = False
 *     else:
 *         full_atom_names = [ensure_context(atom) for atom in atom_names]             # <<<<<<<<<<<<<<
 * 
 *         if not all(
 */
  /*else*/ {
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3275, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __pyx_cur_scope->__pyx_v_atom_names; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0;
      for (;;) {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_6); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 3275, __pyx_L8_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3275, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_XDECREF_SET(__pyx_9genexpr46__pyx_v_atom, __pyx_t_6);
        __pyx_t_6 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_ensure_context); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3275, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_6 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_9genexpr46__pyx_v_atom) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_9genexpr46__pyx_v_atom);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3275, __pyx_L8_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 3275, __pyx_L8_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_9genexpr46__pyx_v_atom); __pyx_9genexpr46__pyx_v_atom = 0;
      goto __pyx_L11_exit_scope;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_9genexpr46__pyx_v_atom); __pyx_9genexpr46__pyx_v_atom = 0;
      goto __pyx_L1_error;
      __pyx_L11_exit_scope:;
    } /* exit inner scope */
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_cur_scope->__pyx_v_full_atom_names = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/core/expression.py":3278
 * 
 *         if not all(
 *             _is_neutral_symbol(atom, None, evaluation) for atom in full_atom_names             # <<<<<<<<<<<<<<
 *         ):
 *             optimize = False
 */
    __pyx_t_3 = __pyx_pf_7mathics_4core_10expression_21atom_list_constructor_7genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 3278, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mathics/core/expression.py":3277
 *         full_atom_names = [ensure_context(atom) for atom in atom_names]
 * 
 *         if not all(             # <<<<<<<<<<<<<<
 *             _is_neutral_symbol(atom, None, evaluation) for atom in full_atom_names
 *         ):
 */
    __pyx_t_8 = ((!__pyx_t_1) != 0);
    if (__pyx_t_8) {

      /* "mathics/core/expression.py":3280
 *             _is_neutral_symbol(atom, None, evaluation) for atom in full_atom_names
 *         ):
 *             optimize = False             # <<<<<<<<<<<<<<
 *         else:
 *             optimize = True
 */
      __pyx_v_optimize = 0;

      /* "mathics/core/expression.py":3277
 *         full_atom_names = [ensure_context(atom) for atom in atom_names]
 * 
 *         if not all(             # <<<<<<<<<<<<<<
 *             _is_neutral_symbol(atom, None, evaluation) for atom in full_atom_names
 *         ):
 */
      goto __pyx_L12;
    }

    /* "mathics/core/expression.py":3282
 *             optimize = False
 *         else:
 *             optimize = True             # <<<<<<<<<<<<<<
 * 
 *     if optimize:
 */
    /*else*/ {
      __pyx_v_optimize = 1;
    }
    __pyx_L12:;
  }
  __pyx_L3:;

  /* "mathics/core/expression.py":3284
 *             optimize = True
 * 
 *     if optimize:             # <<<<<<<<<<<<<<
 * 
 *         def construct(leaves):
 */
  __pyx_t_8 = (__pyx_v_optimize != 0);
  if (__pyx_t_8) {

    /* "mathics/core/expression.py":3286
 *     if optimize:
 * 
 *         def construct(leaves):             # <<<<<<<<<<<<<<
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_21atom_list_constructor_1construct, 0, __pyx_n_s_atom_list_constructor_locals_con, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__116)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3286, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_construct = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/core/expression.py":3284
 *             optimize = True
 * 
 *     if optimize:             # <<<<<<<<<<<<<<
 * 
 *         def construct(leaves):
 */
    goto __pyx_L13;
  }

  /* "mathics/core/expression.py":3295
 *     else:
 * 
 *         def construct(leaves):             # <<<<<<<<<<<<<<
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_21atom_list_constructor_3construct, 0, __pyx_n_s_atom_list_constructor_locals_con, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__118)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_construct = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L13:;

  /* "mathics/core/expression.py":3300
 *             return expr
 * 
 *     return construct             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_construct);
  __pyx_r = __pyx_v_construct;
  goto __pyx_L0;

  /* "mathics/core/expression.py":3263
 * 
 * 
 * def atom_list_constructor(evaluation, head, *atom_names):             # <<<<<<<<<<<<<<
 *     # if we encounter an Expression that consists wholly of atoms and those atoms (and the
 *     # expression's head) have no rules associated with them, we can speed up evaluation.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.core.expression.atom_list_constructor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_construct);
  __Pyx_XDECREF(__pyx_9genexpr46__pyx_v_atom);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/core/expression.py":3303
 * 
 * 
 * def string_list(head, leaves, evaluation):             # <<<<<<<<<<<<<<
 *     return atom_list_constructor(evaluation, head, "String")(leaves)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_4core_10expression_37string_list(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_4core_10expression_37string_list = {"string_list", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_4core_10expression_37string_list, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_4core_10expression_37string_list(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_head = 0;
  PyObject *__pyx_v_leaves = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("string_list (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_head,&__pyx_n_s_leaves,&__pyx_n_s_evaluation,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_head)) != 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_leaves)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("string_list", 1, 3, 3, 1); __PYX_ERR(0, 3303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("string_list", 1, 3, 3, 2); __PYX_ERR(0, 3303, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "string_list") < 0)) __PYX_ERR(0, 3303, __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_head = values[0];
    __pyx_v_leaves = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("string_list", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 3303, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.core.expression.string_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_4core_10expression_36string_list(__pyx_self, __pyx_v_head, __pyx_v_leaves, __pyx_v_evaluation);

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

static PyObject *__pyx_pf_7mathics_4core_10expression_36string_list(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_head, PyObject *__pyx_v_leaves, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("string_list", 0);

  /* "mathics/core/expression.py":3304
 * 
 * def string_list(head, leaves, evaluation):
 *     return atom_list_constructor(evaluation, head, "String")(leaves)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_atom_list_constructor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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[4] = {__pyx_t_4, __pyx_v_evaluation, __pyx_v_head, __pyx_n_u_String};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3304, __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[4] = {__pyx_t_4, __pyx_v_evaluation, __pyx_v_head, __pyx_n_u_String};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3304, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3304, __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_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_evaluation);
    __Pyx_INCREF(__pyx_v_head);
    __Pyx_GIVEREF(__pyx_v_head);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_head);
    __Pyx_INCREF(__pyx_n_u_String);
    __Pyx_GIVEREF(__pyx_n_u_String);
    PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_n_u_String);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3304, __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_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_leaves) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_leaves);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3304, __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;

  /* "mathics/core/expression.py":3303
 * 
 * 
 * def string_list(head, leaves, evaluation):             # <<<<<<<<<<<<<<
 *     return atom_list_constructor(evaluation, head, "String")(leaves)
 */

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

static struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct__sliced[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct__sliced = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct__sliced(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct__sliced > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct__sliced[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct__sliced];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced));
    (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_7mathics_4core_10expression___pyx_scope_struct__sliced(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_a);
  Py_CLEAR(p->__pyx_v_b);
  Py_CLEAR(p->__pyx_v_lower);
  Py_CLEAR(p->__pyx_v_seq);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct__sliced < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct__sliced[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct__sliced++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct__sliced(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *)o;
  if (p->__pyx_v_a) {
    e = (*v)(p->__pyx_v_a, a); if (e) return e;
  }
  if (p->__pyx_v_b) {
    e = (*v)(p->__pyx_v_b, a); if (e) return e;
  }
  if (p->__pyx_v_lower) {
    e = (*v)(p->__pyx_v_lower, a); if (e) return e;
  }
  if (p->__pyx_v_seq) {
    e = (*v)(p->__pyx_v_seq, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct__sliced(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced *)o;
  tmp = ((PyObject*)p->__pyx_v_a);
  p->__pyx_v_a = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_b);
  p->__pyx_v_b = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_lower);
  p->__pyx_v_lower = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_seq);
  p->__pyx_v_seq = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct__sliced = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct__sliced", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct__sliced), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct__sliced, /*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_7mathics_4core_10expression___pyx_scope_struct__sliced, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct__sliced, /*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_7mathics_4core_10expression___pyx_scope_struct__sliced, /*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_7mathics_4core_10expression___pyx_scope_struct_1_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___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_7mathics_4core_10expression___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_1_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___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_7mathics_4core_10expression___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_x);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_1_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___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_x) {
    e = (*v)(p->__pyx_v_x, 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_7mathics_4core_10expression___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___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_7mathics_4core_10expression___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_7mathics_4core_10expression___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_7mathics_4core_10expression___pyx_scope_struct_2_do_format *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_2_do_format[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_2_do_format = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_2_do_format(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_2_do_format > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_2_do_format[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_2_do_format];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format));
    (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_7mathics_4core_10expression___pyx_scope_struct_2_do_format(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_evaluation);
  Py_CLEAR(p->__pyx_v_form);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_2_do_format < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_2_do_format[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_2_do_format++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_2_do_format(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *)o;
  if (p->__pyx_v_evaluation) {
    e = (*v)(p->__pyx_v_evaluation, a); if (e) return e;
  }
  if (p->__pyx_v_form) {
    e = (*v)(p->__pyx_v_form, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_2_do_format(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format *)o;
  tmp = ((PyObject*)p->__pyx_v_evaluation);
  p->__pyx_v_evaluation = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_form);
  p->__pyx_v_form = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_2_do_format = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_2_do_format", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_2_do_format), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_2_do_format, /*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_7mathics_4core_10expression___pyx_scope_struct_2_do_format, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_2_do_format, /*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_7mathics_4core_10expression___pyx_scope_struct_2_do_format, /*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_7mathics_4core_10expression___pyx_scope_struct_3___cmp *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_3___cmp[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_3___cmp = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_3___cmp(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_3___cmp > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_3___cmp[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_3___cmp];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp));
    (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_7mathics_4core_10expression___pyx_scope_struct_3___cmp(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_other_exps);
  Py_CLEAR(p->__pyx_v_self_exps);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_3___cmp < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_3___cmp[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_3___cmp++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_3___cmp(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *)o;
  if (p->__pyx_v_other_exps) {
    e = (*v)(p->__pyx_v_other_exps, a); if (e) return e;
  }
  if (p->__pyx_v_self_exps) {
    e = (*v)(p->__pyx_v_self_exps, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_3___cmp(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp *)o;
  tmp = ((PyObject*)p->__pyx_v_other_exps);
  p->__pyx_v_other_exps = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self_exps);
  p->__pyx_v_self_exps = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_3___cmp = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_3___cmp", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_3___cmp), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_3___cmp, /*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_7mathics_4core_10expression___pyx_scope_struct_3___cmp, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_3___cmp, /*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_7mathics_4core_10expression___pyx_scope_struct_3___cmp, /*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_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_4_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_4_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_4_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_4_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_4_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_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_7mathics_4core_10expression___pyx_scope_struct_4_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_exp);
  Py_CLEAR(p->__pyx_v_var);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_4_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_4_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_exp) {
    e = (*v)(p->__pyx_v_exp, a); if (e) return e;
  }
  if (p->__pyx_v_var) {
    e = (*v)(p->__pyx_v_var, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_4_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_4_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_4_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_4_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  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_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_5_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_5_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_5_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_5_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_5_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_exp);
  Py_CLEAR(p->__pyx_v_var);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_5_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_exp) {
    e = (*v)(p->__pyx_v_exp, a); if (e) return e;
  }
  if (p->__pyx_v_var) {
    e = (*v)(p->__pyx_v_var, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_5_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_5_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_5_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_5_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_7mathics_4core_10expression___pyx_scope_struct_5_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_7mathics_4core_10expression___pyx_scope_struct_5_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #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_7mathics_4core_10expression___pyx_scope_struct_6___new__ *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_6___new__[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_6___new__ = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_6___new__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_6___new__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_6___new__[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_6___new__];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__));
    (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_7mathics_4core_10expression___pyx_scope_struct_6___new__(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_leaves);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_6___new__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_6___new__[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_6___new__++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_6___new__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *)o;
  if (p->__pyx_v_leaves) {
    e = (*v)(p->__pyx_v_leaves, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_6___new__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__ *)o;
  tmp = ((PyObject*)p->__pyx_v_leaves);
  p->__pyx_v_leaves = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_6___new__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_6___new__", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_6___new__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_6___new__, /*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_7mathics_4core_10expression___pyx_scope_struct_6___new__, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_6___new__, /*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_7mathics_4core_10expression___pyx_scope_struct_6___new__, /*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_7mathics_4core_10expression___pyx_scope_struct_7_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_7_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_7_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_7_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_7_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_7_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_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_7mathics_4core_10expression___pyx_scope_struct_7_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_leaf);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_7_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_7_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_leaf) {
    e = (*v)(p->__pyx_v_leaf, 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_7mathics_4core_10expression___pyx_scope_struct_7_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_7_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_7_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_7mathics_4core_10expression___pyx_scope_struct_7_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_7mathics_4core_10expression___pyx_scope_struct_7_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_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence));
    (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_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_evaluation);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *)o;
  if (p->__pyx_v_evaluation) {
    e = (*v)(p->__pyx_v_evaluation, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence *)o;
  tmp = ((PyObject*)p->__pyx_v_evaluation);
  p->__pyx_v_evaluation = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_8_flatten_pattern_sequence", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence, /*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_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence, /*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_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence, /*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_7mathics_4core_10expression___pyx_scope_struct_9_copy *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_9_copy[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_9_copy = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_9_copy(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_9_copy > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_9_copy[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_9_copy];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy));
    (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_7mathics_4core_10expression___pyx_scope_struct_9_copy(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_reevaluate);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_9_copy < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_9_copy[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_9_copy++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_9_copy(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *)o;
  if (p->__pyx_v_reevaluate) {
    e = (*v)(p->__pyx_v_reevaluate, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_9_copy(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy *)o;
  tmp = ((PyObject*)p->__pyx_v_reevaluate);
  p->__pyx_v_reevaluate = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_9_copy = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_9_copy", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_9_copy), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_9_copy, /*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_7mathics_4core_10expression___pyx_scope_struct_9_copy, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_9_copy, /*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_7mathics_4core_10expression___pyx_scope_struct_9_copy, /*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_7mathics_4core_10expression___pyx_scope_struct_10_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_10_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_10_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_10_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_10_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_10_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_10_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_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_7mathics_4core_10expression___pyx_scope_struct_10_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_leaf);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_10_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_10_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_10_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_10_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_leaf) {
    e = (*v)(p->__pyx_v_leaf, 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_7mathics_4core_10expression___pyx_scope_struct_10_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_10_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_10_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_10_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_7mathics_4core_10expression___pyx_scope_struct_10_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_7mathics_4core_10expression___pyx_scope_struct_10_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_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes));
    (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_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_res);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *)o;
  if (p->__pyx_v_res) {
    e = (*v)(p->__pyx_v_res, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes *)o;
  tmp = ((PyObject*)p->__pyx_v_res);
  p->__pyx_v_res = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_11_get_attributes", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes, /*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_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes, /*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_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes, /*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_7mathics_4core_10expression___pyx_scope_struct_12_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_12_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_12_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_12_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_12_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_12_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_12_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_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_7mathics_4core_10expression___pyx_scope_struct_12_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_a);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_12_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_12_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_12_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_12_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_a) {
    e = (*v)(p->__pyx_v_a, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_12_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_12_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_12_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_12_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_7mathics_4core_10expression___pyx_scope_struct_12_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_7mathics_4core_10expression___pyx_scope_struct_12_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_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol));
    (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_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_symbol_name);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *)o;
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  if (p->__pyx_v_symbol_name) {
    e = (*v)(p->__pyx_v_symbol_name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_symbol_name);
  p->__pyx_v_symbol_name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_13_has_symbol", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol, /*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_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol, /*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_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol, /*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_7mathics_4core_10expression___pyx_scope_struct_14_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_14_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_14_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_14_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_14_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_14_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_14_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_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_7mathics_4core_10expression___pyx_scope_struct_14_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_leaf);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_14_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_14_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_14_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_14_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_leaf) {
    e = (*v)(p->__pyx_v_leaf, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_14_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_14_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_14_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_14_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_7mathics_4core_10expression___pyx_scope_struct_14_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_7mathics_4core_10expression___pyx_scope_struct_14_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_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key));
    (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_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *)o;
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_15_get_sort_key", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key, /*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_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key, /*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_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key, /*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_7mathics_4core_10expression___pyx_scope_struct_16_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_16_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_16_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_16_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_16_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_16_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_16_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_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_7mathics_4core_10expression___pyx_scope_struct_16_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_leaf);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_16_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_16_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_16_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_16_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_leaf) {
    e = (*v)(p->__pyx_v_leaf, 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_7mathics_4core_10expression___pyx_scope_struct_16_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_16_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_16_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_16_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_7mathics_4core_10expression___pyx_scope_struct_16_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_7mathics_4core_10expression___pyx_scope_struct_16_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_7mathics_4core_10expression___pyx_scope_struct_17_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_17_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_17_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_17_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_17_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_17_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_17_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_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_7mathics_4core_10expression___pyx_scope_struct_17_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_leaf);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_17_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_17_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_17_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_17_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_leaf) {
    e = (*v)(p->__pyx_v_leaf, 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_7mathics_4core_10expression___pyx_scope_struct_17_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_17_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_17_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_17_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_7mathics_4core_10expression___pyx_scope_struct_17_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_7mathics_4core_10expression___pyx_scope_struct_17_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_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next));
    (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_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_attributes);
  Py_CLEAR(p->__pyx_v_evaluation);
  Py_CLEAR(p->__pyx_v_leaves);
  Py_CLEAR(p->__pyx_v_new);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *)o;
  if (p->__pyx_v_attributes) {
    e = (*v)(p->__pyx_v_attributes, a); if (e) return e;
  }
  if (p->__pyx_v_evaluation) {
    e = (*v)(p->__pyx_v_evaluation, a); if (e) return e;
  }
  if (p->__pyx_v_leaves) {
    e = (*v)(p->__pyx_v_leaves, a); if (e) return e;
  }
  if (p->__pyx_v_new) {
    e = (*v)(p->__pyx_v_new, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next *)o;
  tmp = ((PyObject*)p->__pyx_v_attributes);
  p->__pyx_v_attributes = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_evaluation);
  p->__pyx_v_evaluation = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_leaves);
  p->__pyx_v_leaves = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_new);
  p->__pyx_v_new = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_18_evaluate_next", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next, /*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_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next, /*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_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next, /*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_7mathics_4core_10expression___pyx_scope_struct_19_rules *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_19_rules[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_19_rules = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_19_rules(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_19_rules > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_19_rules[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_19_rules];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules));
    (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_7mathics_4core_10expression___pyx_scope_struct_19_rules(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_leaf);
  Py_CLEAR(p->__pyx_v_lookup_name);
  Py_CLEAR(p->__pyx_v_name);
  Py_CLEAR(p->__pyx_v_rule);
  Py_CLEAR(p->__pyx_v_rules_names);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_3);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_19_rules < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_19_rules[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_19_rules++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_19_rules(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_leaf) {
    e = (*v)(p->__pyx_v_leaf, a); if (e) return e;
  }
  if (p->__pyx_v_lookup_name) {
    e = (*v)(p->__pyx_v_lookup_name, a); if (e) return e;
  }
  if (p->__pyx_v_name) {
    e = (*v)(p->__pyx_v_name, a); if (e) return e;
  }
  if (p->__pyx_v_rule) {
    e = (*v)(p->__pyx_v_rule, a); if (e) return e;
  }
  if (p->__pyx_v_rules_names) {
    e = (*v)(p->__pyx_v_rules_names, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_3) {
    e = (*v)(p->__pyx_t_3, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_19_rules = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_19_rules", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_19_rules), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_19_rules, /*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_7mathics_4core_10expression___pyx_scope_struct_19_rules, /*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_7mathics_4core_10expression___pyx_scope_struct_19_rules, /*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_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior));
    (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_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_content);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *)o;
  if (p->__pyx_v_content) {
    e = (*v)(p->__pyx_v_content, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior *)o;
  tmp = ((PyObject*)p->__pyx_v_content);
  p->__pyx_v_content = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_20_is_list_interior", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior, /*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_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior, /*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_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior, /*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_7mathics_4core_10expression___pyx_scope_struct_21_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_21_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_21_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_21_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_21_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_21_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_21_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_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_7mathics_4core_10expression___pyx_scope_struct_21_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_leaf);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_21_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_21_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_21_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_21_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_leaf) {
    e = (*v)(p->__pyx_v_leaf, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_21_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_21_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_21_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_21_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_7mathics_4core_10expression___pyx_scope_struct_21_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_7mathics_4core_10expression___pyx_scope_struct_21_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_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules));
    (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_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_apply_leaf);
  Py_CLEAR(p->__pyx_v_evaluation);
  Py_CLEAR(p->__pyx_v_level);
  Py_CLEAR(p->__pyx_v_new_applied);
  Py_CLEAR(p->__pyx_v_options);
  Py_CLEAR(p->__pyx_v_rules);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *)o;
  if (p->__pyx_v_apply_leaf) {
    e = (*v)(p->__pyx_v_apply_leaf, a); if (e) return e;
  }
  if (p->__pyx_v_evaluation) {
    e = (*v)(p->__pyx_v_evaluation, a); if (e) return e;
  }
  if (p->__pyx_v_level) {
    e = (*v)(p->__pyx_v_level, a); if (e) return e;
  }
  if (p->__pyx_v_new_applied) {
    e = (*v)(p->__pyx_v_new_applied, a); if (e) return e;
  }
  if (p->__pyx_v_options) {
    e = (*v)(p->__pyx_v_options, a); if (e) return e;
  }
  if (p->__pyx_v_rules) {
    e = (*v)(p->__pyx_v_rules, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules *)o;
  tmp = ((PyObject*)p->__pyx_v_apply_leaf);
  p->__pyx_v_apply_leaf = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_evaluation);
  p->__pyx_v_evaluation = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_level);
  p->__pyx_v_level = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_new_applied);
  p->__pyx_v_new_applied = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_options);
  p->__pyx_v_options = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_rules);
  p->__pyx_v_rules = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_22_apply_rules", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules, /*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_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules, /*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_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules, /*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_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars));
    (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_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_get_scoping_vars);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *)o;
  if (p->__pyx_v_get_scoping_vars) {
    e = (*v)(p->__pyx_v_get_scoping_vars, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars *)o;
  tmp = ((PyObject*)p->__pyx_v_get_scoping_vars);
  p->__pyx_v_get_scoping_vars = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_23_replace_vars", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars, /*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_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars, /*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_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars, /*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_7mathics_4core_10expression___pyx_scope_struct_24_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_24_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_24_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_24_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_24_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_24_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_24_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_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_7mathics_4core_10expression___pyx_scope_struct_24_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_name);
  Py_CLEAR(p->__pyx_v_new_def);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_24_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_24_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_24_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_24_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_name) {
    e = (*v)(p->__pyx_v_name, a); if (e) return e;
  }
  if (p->__pyx_v_new_def) {
    e = (*v)(p->__pyx_v_new_def, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_24_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_24_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_24_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_24_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_7mathics_4core_10expression___pyx_scope_struct_24_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_7mathics_4core_10expression___pyx_scope_struct_24_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_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric));
    (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_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *)o;
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_25_is_numeric", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric, /*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_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric, /*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_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric, /*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_7mathics_4core_10expression___pyx_scope_struct_26_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_26_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_26_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_26_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_26_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_26_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_26_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_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_7mathics_4core_10expression___pyx_scope_struct_26_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_leaf);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_26_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_26_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_26_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_26_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_leaf) {
    e = (*v)(p->__pyx_v_leaf, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_26_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_26_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_26_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_26_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_7mathics_4core_10expression___pyx_scope_struct_26_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_7mathics_4core_10expression___pyx_scope_struct_26_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_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars));
    (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_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_vars);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *)o;
  if (p->__pyx_v_vars) {
    e = (*v)(p->__pyx_v_vars, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars *)o;
  tmp = ((PyObject*)p->__pyx_v_vars);
  p->__pyx_v_vars = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_27_replace_vars", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars, /*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_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars, /*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_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars, /*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_7mathics_4core_10expression___pyx_scope_struct_28_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_28_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_28_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_28_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_28_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_28_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_28_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_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_7mathics_4core_10expression___pyx_scope_struct_28_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_v);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_28_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_28_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_28_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_28_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_28_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_28_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_28_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_28_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_7mathics_4core_10expression___pyx_scope_struct_28_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_7mathics_4core_10expression___pyx_scope_struct_28_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_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex));
    (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_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_in_text);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *)o;
  if (p->__pyx_v_in_text) {
    e = (*v)(p->__pyx_v_in_text, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex *)o;
  tmp = ((PyObject*)p->__pyx_v_in_text);
  p->__pyx_v_in_text = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_29_encode_tex", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex, /*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_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex, /*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_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex, /*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_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol));
    (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_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_definition);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *)o;
  if (p->__pyx_v_definition) {
    e = (*v)(p->__pyx_v_definition, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol *)o;
  tmp = ((PyObject*)p->__pyx_v_definition);
  p->__pyx_v_definition = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_30__is_neutral_symbol", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol, /*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_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol, /*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_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol, /*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_7mathics_4core_10expression___pyx_scope_struct_31_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_31_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_31_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_31_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_31_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_31_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_31_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_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_7mathics_4core_10expression___pyx_scope_struct_31_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_x);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_31_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_31_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_31_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_31_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_31_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_31_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_31_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_31_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_31_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_31_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  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_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor));
    (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_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_atom_names);
  Py_CLEAR(p->__pyx_v_evaluation);
  Py_CLEAR(p->__pyx_v_full_atom_names);
  Py_CLEAR(p->__pyx_v_head);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *)o;
  if (p->__pyx_v_atom_names) {
    e = (*v)(p->__pyx_v_atom_names, a); if (e) return e;
  }
  if (p->__pyx_v_evaluation) {
    e = (*v)(p->__pyx_v_evaluation, a); if (e) return e;
  }
  if (p->__pyx_v_full_atom_names) {
    e = (*v)(p->__pyx_v_full_atom_names, a); if (e) return e;
  }
  if (p->__pyx_v_head) {
    e = (*v)(p->__pyx_v_head, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor *)o;
  tmp = ((PyObject*)p->__pyx_v_atom_names);
  p->__pyx_v_atom_names = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_evaluation);
  p->__pyx_v_evaluation = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_full_atom_names);
  p->__pyx_v_full_atom_names = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_head);
  p->__pyx_v_head = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_32_atom_list_constructor", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor, /*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_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor, /*tp_traverse*/
  __pyx_tp_clear_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor, /*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_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor, /*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_7mathics_4core_10expression___pyx_scope_struct_33_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_33_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_33_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_33_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_33_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_33_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_33_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_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_7mathics_4core_10expression___pyx_scope_struct_33_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_atom);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_33_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_33_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_33_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_33_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_atom) {
    e = (*v)(p->__pyx_v_atom, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_33_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_33_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_33_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_33_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_7mathics_4core_10expression___pyx_scope_struct_33_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_7mathics_4core_10expression___pyx_scope_struct_33_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_7mathics_4core_10expression___pyx_scope_struct_34_genexpr *__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_34_genexpr[8];
static int __pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_34_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_4core_10expression___pyx_scope_struct_34_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_34_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_34_genexpr[--__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_34_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_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_7mathics_4core_10expression___pyx_scope_struct_34_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_atom);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_34_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr)))) {
    __pyx_freelist_7mathics_4core_10expression___pyx_scope_struct_34_genexpr[__pyx_freecount_7mathics_4core_10expression___pyx_scope_struct_34_genexpr++] = ((struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_4core_10expression___pyx_scope_struct_34_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr *p = (struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_atom) {
    e = (*v)(p->__pyx_v_atom, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_4core_10expression___pyx_scope_struct_34_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.core.expression.__pyx_scope_struct_34_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_4core_10expression___pyx_scope_struct_34_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_4core_10expression___pyx_scope_struct_34_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_7mathics_4core_10expression___pyx_scope_struct_34_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_7mathics_4core_10expression___pyx_scope_struct_34_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 PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_expression(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_expression},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "expression",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
  {&__pyx_kp_u_0, __pyx_k_0, sizeof(__pyx_k_0), 0, 1, 0, 0},
  {&__pyx_kp_u_0123456789, __pyx_k_0123456789, sizeof(__pyx_k_0123456789), 0, 1, 0, 0},
  {&__pyx_kp_u_0_2, __pyx_k_0_2, sizeof(__pyx_k_0_2), 0, 1, 0, 0},
  {&__pyx_kp_u_0_9, __pyx_k_0_9, sizeof(__pyx_k_0_9), 0, 1, 0, 0},
  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
  {&__pyx_kp_u_Aborted, __pyx_k_Aborted, sizeof(__pyx_k_Aborted), 0, 1, 0, 0},
  {&__pyx_n_u_Abs, __pyx_k_Abs, sizeof(__pyx_k_Abs), 0, 1, 0, 1},
  {&__pyx_kp_s_An_object_to_sort_monomials_use, __pyx_k_An_object_to_sort_monomials_use, sizeof(__pyx_k_An_object_to_sort_monomials_use), 0, 0, 1, 0},
  {&__pyx_n_s_Any, __pyx_k_Any, sizeof(__pyx_k_Any), 0, 0, 1, 1},
  {&__pyx_kp_s_Arbitrary_precision_real_number, __pyx_k_Arbitrary_precision_real_number, sizeof(__pyx_k_Arbitrary_precision_real_number), 0, 0, 1, 0},
  {&__pyx_kp_u_Argument_imag_must_be_a_real_num, __pyx_k_Argument_imag_must_be_a_real_num, sizeof(__pyx_k_Argument_imag_must_be_a_real_num), 0, 1, 0, 0},
  {&__pyx_kp_u_Argument_real_must_be_a_real_num, __pyx_k_Argument_real_must_be_a_real_num, sizeof(__pyx_k_Argument_real_must_be_a_real_num), 0, 1, 0, 0},
  {&__pyx_n_u_Association, __pyx_k_Association, sizeof(__pyx_k_Association), 0, 1, 0, 1},
  {&__pyx_n_s_Atom, __pyx_k_Atom, sizeof(__pyx_k_Atom), 0, 0, 1, 1},
  {&__pyx_n_u_Atom, __pyx_k_Atom, sizeof(__pyx_k_Atom), 0, 1, 0, 1},
  {&__pyx_n_s_Atom___repr, __pyx_k_Atom___repr, sizeof(__pyx_k_Atom___repr), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_atom_to_boxes, __pyx_k_Atom_atom_to_boxes, sizeof(__pyx_k_Atom_atom_to_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_copy, __pyx_k_Atom_copy, sizeof(__pyx_k_Atom_copy), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_equal2, __pyx_k_Atom_equal2, sizeof(__pyx_k_Atom_equal2), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_get_atom_name, __pyx_k_Atom_get_atom_name, sizeof(__pyx_k_Atom_get_atom_name), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_get_atoms, __pyx_k_Atom_get_atoms, sizeof(__pyx_k_Atom_get_atoms), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_get_head, __pyx_k_Atom_get_head, sizeof(__pyx_k_Atom_get_head), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_get_sort_key, __pyx_k_Atom_get_sort_key, sizeof(__pyx_k_Atom_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_has_form, __pyx_k_Atom_has_form, sizeof(__pyx_k_Atom_has_form), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_has_symbol, __pyx_k_Atom_has_symbol, sizeof(__pyx_k_Atom_has_symbol), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_is_atom, __pyx_k_Atom_is_atom, sizeof(__pyx_k_Atom_is_atom), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_numerify, __pyx_k_Atom_numerify, sizeof(__pyx_k_Atom_numerify), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_replace_slots, __pyx_k_Atom_replace_slots, sizeof(__pyx_k_Atom_replace_slots), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_replace_vars, __pyx_k_Atom_replace_vars, sizeof(__pyx_k_Atom_replace_vars), 0, 0, 1, 1},
  {&__pyx_n_s_Atom_set_positions, __pyx_k_Atom_set_positions, sizeof(__pyx_k_Atom_set_positions), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression, __pyx_k_BaseExpression, sizeof(__pyx_k_BaseExpression), 0, 0, 1, 1},
  {&__pyx_n_u_BaseExpression, __pyx_k_BaseExpression, sizeof(__pyx_k_BaseExpression), 0, 1, 0, 1},
  {&__pyx_n_s_BaseExpression___abs, __pyx_k_BaseExpression___abs, sizeof(__pyx_k_BaseExpression___abs), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression___add, __pyx_k_BaseExpression___add, sizeof(__pyx_k_BaseExpression___add), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression___floordiv, __pyx_k_BaseExpression___floordiv, sizeof(__pyx_k_BaseExpression___floordiv), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression___hash, __pyx_k_BaseExpression___hash, sizeof(__pyx_k_BaseExpression___hash), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression___mul, __pyx_k_BaseExpression___mul, sizeof(__pyx_k_BaseExpression___mul), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression___neg, __pyx_k_BaseExpression___neg, sizeof(__pyx_k_BaseExpression___neg), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression___new, __pyx_k_BaseExpression___new, sizeof(__pyx_k_BaseExpression___new), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression___pos, __pyx_k_BaseExpression___pos, sizeof(__pyx_k_BaseExpression___pos), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression___pow, __pyx_k_BaseExpression___pow, sizeof(__pyx_k_BaseExpression___pow), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression___sub, __pyx_k_BaseExpression___sub, sizeof(__pyx_k_BaseExpression___sub), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression___truediv, __pyx_k_BaseExpression___truediv, sizeof(__pyx_k_BaseExpression___truediv), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_apply_rules, __pyx_k_BaseExpression_apply_rules, sizeof(__pyx_k_BaseExpression_apply_rules), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_clear_cache, __pyx_k_BaseExpression_clear_cache, sizeof(__pyx_k_BaseExpression_clear_cache), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_do_format, __pyx_k_BaseExpression_do_format, sizeof(__pyx_k_BaseExpression_do_format), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_do_format_locals, __pyx_k_BaseExpression_do_format_locals, sizeof(__pyx_k_BaseExpression_do_format_locals), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_equal2, __pyx_k_BaseExpression_equal2, sizeof(__pyx_k_BaseExpression_equal2), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_evaluate, __pyx_k_BaseExpression_evaluate, sizeof(__pyx_k_BaseExpression_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_evaluate_leaves, __pyx_k_BaseExpression_evaluate_leaves, sizeof(__pyx_k_BaseExpression_evaluate_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_evaluate_next, __pyx_k_BaseExpression_evaluate_next, sizeof(__pyx_k_BaseExpression_evaluate_next), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_flatten, __pyx_k_BaseExpression_flatten, sizeof(__pyx_k_BaseExpression_flatten), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_flatten_pattern_s, __pyx_k_BaseExpression_flatten_pattern_s, sizeof(__pyx_k_BaseExpression_flatten_pattern_s), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_flatten_sequence, __pyx_k_BaseExpression_flatten_sequence, sizeof(__pyx_k_BaseExpression_flatten_sequence), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_format, __pyx_k_BaseExpression_format, sizeof(__pyx_k_BaseExpression_format), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_atoms, __pyx_k_BaseExpression_get_atoms, sizeof(__pyx_k_BaseExpression_get_atoms), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_attributes, __pyx_k_BaseExpression_get_attributes, sizeof(__pyx_k_BaseExpression_get_attributes), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_float_value, __pyx_k_BaseExpression_get_float_value, sizeof(__pyx_k_BaseExpression_get_float_value), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_head, __pyx_k_BaseExpression_get_head, sizeof(__pyx_k_BaseExpression_get_head), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_head_name, __pyx_k_BaseExpression_get_head_name, sizeof(__pyx_k_BaseExpression_get_head_name), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_int_value, __pyx_k_BaseExpression_get_int_value, sizeof(__pyx_k_BaseExpression_get_int_value), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_leaves, __pyx_k_BaseExpression_get_leaves, sizeof(__pyx_k_BaseExpression_get_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_lookup_name, __pyx_k_BaseExpression_get_lookup_name, sizeof(__pyx_k_BaseExpression_get_lookup_name), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_name, __pyx_k_BaseExpression_get_name, sizeof(__pyx_k_BaseExpression_get_name), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_option_values, __pyx_k_BaseExpression_get_option_values, sizeof(__pyx_k_BaseExpression_get_option_values), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_precision, __pyx_k_BaseExpression_get_precision, sizeof(__pyx_k_BaseExpression_get_precision), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_rules_list, __pyx_k_BaseExpression_get_rules_list, sizeof(__pyx_k_BaseExpression_get_rules_list), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_sequence, __pyx_k_BaseExpression_get_sequence, sizeof(__pyx_k_BaseExpression_get_sequence), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_get_string_value, __pyx_k_BaseExpression_get_string_value, sizeof(__pyx_k_BaseExpression_get_string_value), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_has_changed, __pyx_k_BaseExpression_has_changed, sizeof(__pyx_k_BaseExpression_has_changed), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_has_form, __pyx_k_BaseExpression_has_form, sizeof(__pyx_k_BaseExpression_has_form), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_is_atom, __pyx_k_BaseExpression_is_atom, sizeof(__pyx_k_BaseExpression_is_atom), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_is_free, __pyx_k_BaseExpression_is_free, sizeof(__pyx_k_BaseExpression_is_free), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_is_inexact, __pyx_k_BaseExpression_is_inexact, sizeof(__pyx_k_BaseExpression_is_inexact), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_is_machine_precis, __pyx_k_BaseExpression_is_machine_precis, sizeof(__pyx_k_BaseExpression_is_machine_precis), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_is_numeric, __pyx_k_BaseExpression_is_numeric, sizeof(__pyx_k_BaseExpression_is_numeric), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_is_symbol, __pyx_k_BaseExpression_is_symbol, sizeof(__pyx_k_BaseExpression_is_symbol), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_is_true, __pyx_k_BaseExpression_is_true, sizeof(__pyx_k_BaseExpression_is_true), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_round_to_float, __pyx_k_BaseExpression_round_to_float, sizeof(__pyx_k_BaseExpression_round_to_float), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_sameQ, __pyx_k_BaseExpression_sameQ, sizeof(__pyx_k_BaseExpression_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_sequences, __pyx_k_BaseExpression_sequences, sizeof(__pyx_k_BaseExpression_sequences), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_to_mpmath, __pyx_k_BaseExpression_to_mpmath, sizeof(__pyx_k_BaseExpression_to_mpmath), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_to_sympy, __pyx_k_BaseExpression_to_sympy, sizeof(__pyx_k_BaseExpression_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_BaseExpression_user_hash, __pyx_k_BaseExpression_user_hash, sizeof(__pyx_k_BaseExpression_user_hash), 0, 0, 1, 1},
  {&__pyx_kp_u_Box, __pyx_k_Box, sizeof(__pyx_k_Box), 0, 1, 0, 0},
  {&__pyx_n_s_BoxConstruct, __pyx_k_BoxConstruct, sizeof(__pyx_k_BoxConstruct), 0, 0, 1, 1},
  {&__pyx_n_s_BoxError, __pyx_k_BoxError, sizeof(__pyx_k_BoxError), 0, 0, 1, 1},
  {&__pyx_n_s_BoxError___init, __pyx_k_BoxError___init, sizeof(__pyx_k_BoxError___init), 0, 0, 1, 1},
  {&__pyx_n_u_ByteArray, __pyx_k_ByteArray, sizeof(__pyx_k_ByteArray), 0, 1, 0, 1},
  {&__pyx_n_s_ByteArrayAtom, __pyx_k_ByteArrayAtom, sizeof(__pyx_k_ByteArrayAtom), 0, 0, 1, 1},
  {&__pyx_n_u_ByteArrayAtom, __pyx_k_ByteArrayAtom, sizeof(__pyx_k_ByteArrayAtom), 0, 1, 0, 1},
  {&__pyx_n_s_ByteArrayAtom___getnewargs, __pyx_k_ByteArrayAtom___getnewargs, sizeof(__pyx_k_ByteArrayAtom___getnewargs), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom___hash, __pyx_k_ByteArrayAtom___hash, sizeof(__pyx_k_ByteArrayAtom___hash), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom___new, __pyx_k_ByteArrayAtom___new, sizeof(__pyx_k_ByteArrayAtom___new), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom___str, __pyx_k_ByteArrayAtom___str, sizeof(__pyx_k_ByteArrayAtom___str), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_atom_to_boxes, __pyx_k_ByteArrayAtom_atom_to_boxes, sizeof(__pyx_k_ByteArrayAtom_atom_to_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_boxes_to_mathml, __pyx_k_ByteArrayAtom_boxes_to_mathml, sizeof(__pyx_k_ByteArrayAtom_boxes_to_mathml), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_boxes_to_tex, __pyx_k_ByteArrayAtom_boxes_to_tex, sizeof(__pyx_k_ByteArrayAtom_boxes_to_tex), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_boxes_to_text, __pyx_k_ByteArrayAtom_boxes_to_text, sizeof(__pyx_k_ByteArrayAtom_boxes_to_text), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_default_format, __pyx_k_ByteArrayAtom_default_format, sizeof(__pyx_k_ByteArrayAtom_default_format), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_do_copy, __pyx_k_ByteArrayAtom_do_copy, sizeof(__pyx_k_ByteArrayAtom_do_copy), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_get_sort_key, __pyx_k_ByteArrayAtom_get_sort_key, sizeof(__pyx_k_ByteArrayAtom_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_get_string_value, __pyx_k_ByteArrayAtom_get_string_value, sizeof(__pyx_k_ByteArrayAtom_get_string_value), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_sameQ, __pyx_k_ByteArrayAtom_sameQ, sizeof(__pyx_k_ByteArrayAtom_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_to_python, __pyx_k_ByteArrayAtom_to_python, sizeof(__pyx_k_ByteArrayAtom_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_to_sympy, __pyx_k_ByteArrayAtom_to_sympy, sizeof(__pyx_k_ByteArrayAtom_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_ByteArrayAtom_user_hash, __pyx_k_ByteArrayAtom_user_hash, sizeof(__pyx_k_ByteArrayAtom_user_hash), 0, 0, 1, 1},
  {&__pyx_n_s_COMPARE_PREC, __pyx_k_COMPARE_PREC, sizeof(__pyx_k_COMPARE_PREC), 0, 0, 1, 1},
  {&__pyx_n_u_Catalan, __pyx_k_Catalan, sizeof(__pyx_k_Catalan), 0, 1, 0, 1},
  {&__pyx_n_s_Complex, __pyx_k_Complex, sizeof(__pyx_k_Complex), 0, 0, 1, 1},
  {&__pyx_n_u_Complex, __pyx_k_Complex, sizeof(__pyx_k_Complex), 0, 1, 0, 1},
  {&__pyx_n_u_ComplexInfinity, __pyx_k_ComplexInfinity, sizeof(__pyx_k_ComplexInfinity), 0, 1, 0, 1},
  {&__pyx_kp_u_Complex_2, __pyx_k_Complex_2, sizeof(__pyx_k_Complex_2), 0, 1, 0, 0},
  {&__pyx_n_s_Complex___eq, __pyx_k_Complex___eq, sizeof(__pyx_k_Complex___eq), 0, 0, 1, 1},
  {&__pyx_n_s_Complex___getnewargs, __pyx_k_Complex___getnewargs, sizeof(__pyx_k_Complex___getnewargs), 0, 0, 1, 1},
  {&__pyx_n_s_Complex___hash, __pyx_k_Complex___hash, sizeof(__pyx_k_Complex___hash), 0, 0, 1, 1},
  {&__pyx_n_s_Complex___neg, __pyx_k_Complex___neg, sizeof(__pyx_k_Complex___neg), 0, 0, 1, 1},
  {&__pyx_n_s_Complex___new, __pyx_k_Complex___new, sizeof(__pyx_k_Complex___new), 0, 0, 1, 1},
  {&__pyx_n_s_Complex___str, __pyx_k_Complex___str, sizeof(__pyx_k_Complex___str), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_atom_to_boxes, __pyx_k_Complex_atom_to_boxes, sizeof(__pyx_k_Complex_atom_to_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_default_format, __pyx_k_Complex_default_format, sizeof(__pyx_k_Complex_default_format), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_do_copy, __pyx_k_Complex_do_copy, sizeof(__pyx_k_Complex_do_copy), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_do_format, __pyx_k_Complex_do_format, sizeof(__pyx_k_Complex_do_format), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_evaluate, __pyx_k_Complex_evaluate, sizeof(__pyx_k_Complex_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_get_float_value, __pyx_k_Complex_get_float_value, sizeof(__pyx_k_Complex_get_float_value), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_get_precision, __pyx_k_Complex_get_precision, sizeof(__pyx_k_Complex_get_precision), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_get_sort_key, __pyx_k_Complex_get_sort_key, sizeof(__pyx_k_Complex_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_is_approx_zero, __pyx_k_Complex_is_approx_zero, sizeof(__pyx_k_Complex_is_approx_zero), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_is_machine_precision, __pyx_k_Complex_is_machine_precision, sizeof(__pyx_k_Complex_is_machine_precision), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_is_zero, __pyx_k_Complex_is_zero, sizeof(__pyx_k_Complex_is_zero), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_round, __pyx_k_Complex_round, sizeof(__pyx_k_Complex_round), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_sameQ, __pyx_k_Complex_sameQ, sizeof(__pyx_k_Complex_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_to_mpmath, __pyx_k_Complex_to_mpmath, sizeof(__pyx_k_Complex_to_mpmath), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_to_python, __pyx_k_Complex_to_python, sizeof(__pyx_k_Complex_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_to_sympy, __pyx_k_Complex_to_sympy, sizeof(__pyx_k_Complex_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_Complex_user_hash, __pyx_k_Complex_user_hash, sizeof(__pyx_k_Complex_user_hash), 0, 0, 1, 1},
  {&__pyx_kp_s_Complex_wraps_two_real_valued_N, __pyx_k_Complex_wraps_two_real_valued_N, sizeof(__pyx_k_Complex_wraps_two_real_valued_N), 0, 0, 1, 0},
  {&__pyx_n_u_Default, __pyx_k_Default, sizeof(__pyx_k_Default), 0, 1, 0, 1},
  {&__pyx_n_u_DigitBlock, __pyx_k_DigitBlock, sizeof(__pyx_k_DigitBlock), 0, 1, 0, 1},
  {&__pyx_n_u_DirectedInfinity, __pyx_k_DirectedInfinity, sizeof(__pyx_k_DirectedInfinity), 0, 1, 0, 1},
  {&__pyx_n_u_Divide, __pyx_k_Divide, sizeof(__pyx_k_Divide), 0, 1, 0, 1},
  {&__pyx_n_u_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 1, 0, 1},
  {&__pyx_n_u_EulerGamma, __pyx_k_EulerGamma, sizeof(__pyx_k_EulerGamma), 0, 1, 0, 1},
  {&__pyx_n_u_Evaluate, __pyx_k_Evaluate, sizeof(__pyx_k_Evaluate), 0, 1, 0, 1},
  {&__pyx_n_s_ExponentFunction, __pyx_k_ExponentFunction, sizeof(__pyx_k_ExponentFunction), 0, 0, 1, 1},
  {&__pyx_n_u_ExponentFunction_2, __pyx_k_ExponentFunction_2, sizeof(__pyx_k_ExponentFunction_2), 0, 1, 0, 1},
  {&__pyx_n_u_ExponentStep, __pyx_k_ExponentStep, sizeof(__pyx_k_ExponentStep), 0, 1, 0, 1},
  {&__pyx_n_s_Expression, __pyx_k_Expression, sizeof(__pyx_k_Expression), 0, 0, 1, 1},
  {&__pyx_n_u_Expression, __pyx_k_Expression, sizeof(__pyx_k_Expression), 0, 1, 0, 1},
  {&__pyx_n_s_ExpressionCache, __pyx_k_ExpressionCache, sizeof(__pyx_k_ExpressionCache), 0, 0, 1, 1},
  {&__pyx_n_s_ExpressionCache___init, __pyx_k_ExpressionCache___init, sizeof(__pyx_k_ExpressionCache___init), 0, 0, 1, 1},
  {&__pyx_n_s_ExpressionCache_copy, __pyx_k_ExpressionCache_copy, sizeof(__pyx_k_ExpressionCache_copy), 0, 0, 1, 1},
  {&__pyx_n_s_ExpressionCache_reordered, __pyx_k_ExpressionCache_reordered, sizeof(__pyx_k_ExpressionCache_reordered), 0, 0, 1, 1},
  {&__pyx_n_s_ExpressionCache_sliced, __pyx_k_ExpressionCache_sliced, sizeof(__pyx_k_ExpressionCache_sliced), 0, 0, 1, 1},
  {&__pyx_n_s_ExpressionCache_sliced_locals_ge, __pyx_k_ExpressionCache_sliced_locals_ge, sizeof(__pyx_k_ExpressionCache_sliced_locals_ge), 0, 0, 1, 1},
  {&__pyx_n_s_ExpressionCache_union, __pyx_k_ExpressionCache_union, sizeof(__pyx_k_ExpressionCache_union), 0, 0, 1, 1},
  {&__pyx_n_s_ExpressionPointer, __pyx_k_ExpressionPointer, sizeof(__pyx_k_ExpressionPointer), 0, 0, 1, 1},
  {&__pyx_n_s_ExpressionPointer___init, __pyx_k_ExpressionPointer___init, sizeof(__pyx_k_ExpressionPointer___init), 0, 0, 1, 1},
  {&__pyx_n_s_ExpressionPointer___str, __pyx_k_ExpressionPointer___str, sizeof(__pyx_k_ExpressionPointer___str), 0, 0, 1, 1},
  {&__pyx_n_s_ExpressionPointer_replace, __pyx_k_ExpressionPointer_replace, sizeof(__pyx_k_ExpressionPointer_replace), 0, 0, 1, 1},
  {&__pyx_n_s_Expression___getnewargs, __pyx_k_Expression___getnewargs, sizeof(__pyx_k_Expression___getnewargs), 0, 0, 1, 1},
  {&__pyx_n_s_Expression___hash, __pyx_k_Expression___hash, sizeof(__pyx_k_Expression___hash), 0, 0, 1, 1},
  {&__pyx_n_s_Expression___new, __pyx_k_Expression___new, sizeof(__pyx_k_Expression___new), 0, 0, 1, 1},
  {&__pyx_n_s_Expression___new___locals_genexp, __pyx_k_Expression___new___locals_genexp, sizeof(__pyx_k_Expression___new___locals_genexp), 0, 0, 1, 1},
  {&__pyx_n_s_Expression___repr, __pyx_k_Expression___repr, sizeof(__pyx_k_Expression___repr), 0, 0, 1, 1},
  {&__pyx_n_s_Expression___str, __pyx_k_Expression___str, sizeof(__pyx_k_Expression___str), 0, 0, 1, 1},
  {&__pyx_n_s_Expression__as_sympy_function, __pyx_k_Expression__as_sympy_function, sizeof(__pyx_k_Expression__as_sympy_function), 0, 0, 1, 1},
  {&__pyx_n_s_Expression__flatten_sequence, __pyx_k_Expression__flatten_sequence, sizeof(__pyx_k_Expression__flatten_sequence), 0, 0, 1, 1},
  {&__pyx_n_s_Expression__no_symbol, __pyx_k_Expression__no_symbol, sizeof(__pyx_k_Expression__no_symbol), 0, 0, 1, 1},
  {&__pyx_n_s_Expression__rebuild_cache, __pyx_k_Expression__rebuild_cache, sizeof(__pyx_k_Expression__rebuild_cache), 0, 0, 1, 1},
  {&__pyx_n_s_Expression__timestamp_cache, __pyx_k_Expression__timestamp_cache, sizeof(__pyx_k_Expression__timestamp_cache), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_apply_rules, __pyx_k_Expression_apply_rules, sizeof(__pyx_k_Expression_apply_rules), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_apply_rules_locals_ap, __pyx_k_Expression_apply_rules_locals_ap, sizeof(__pyx_k_Expression_apply_rules_locals_ap), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_apply_rules_locals_de, __pyx_k_Expression_apply_rules_locals_de, sizeof(__pyx_k_Expression_apply_rules_locals_de), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_boxes_to_mathml, __pyx_k_Expression_boxes_to_mathml, sizeof(__pyx_k_Expression_boxes_to_mathml), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_boxes_to_mathml_local, __pyx_k_Expression_boxes_to_mathml_local, sizeof(__pyx_k_Expression_boxes_to_mathml_local), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_boxes_to_mathml_local_2, __pyx_k_Expression_boxes_to_mathml_local_2, sizeof(__pyx_k_Expression_boxes_to_mathml_local_2), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_boxes_to_tex, __pyx_k_Expression_boxes_to_tex, sizeof(__pyx_k_Expression_boxes_to_tex), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_boxes_to_tex_locals_b, __pyx_k_Expression_boxes_to_tex_locals_b, sizeof(__pyx_k_Expression_boxes_to_tex_locals_b), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_boxes_to_text, __pyx_k_Expression_boxes_to_text, sizeof(__pyx_k_Expression_boxes_to_text), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_copy, __pyx_k_Expression_copy, sizeof(__pyx_k_Expression_copy), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_copy_locals_genexpr, __pyx_k_Expression_copy_locals_genexpr, sizeof(__pyx_k_Expression_copy_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_default_format, __pyx_k_Expression_default_format, sizeof(__pyx_k_Expression_default_format), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_do_format, __pyx_k_Expression_do_format, sizeof(__pyx_k_Expression_do_format), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_equal2, __pyx_k_Expression_equal2, sizeof(__pyx_k_Expression_equal2), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_evaluate, __pyx_k_Expression_evaluate, sizeof(__pyx_k_Expression_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_evaluate_leaves, __pyx_k_Expression_evaluate_leaves, sizeof(__pyx_k_Expression_evaluate_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_evaluate_next, __pyx_k_Expression_evaluate_next, sizeof(__pyx_k_Expression_evaluate_next), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_evaluate_next_locals, __pyx_k_Expression_evaluate_next_locals, sizeof(__pyx_k_Expression_evaluate_next_locals), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_evaluate_next_locals_2, __pyx_k_Expression_evaluate_next_locals_2, sizeof(__pyx_k_Expression_evaluate_next_locals_2), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_evaluate_next_locals_3, __pyx_k_Expression_evaluate_next_locals_3, sizeof(__pyx_k_Expression_evaluate_next_locals_3), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_evaluate_next_locals_4, __pyx_k_Expression_evaluate_next_locals_4, sizeof(__pyx_k_Expression_evaluate_next_locals_4), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_filter, __pyx_k_Expression_filter, sizeof(__pyx_k_Expression_filter), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_filter_leaves, __pyx_k_Expression_filter_leaves, sizeof(__pyx_k_Expression_filter_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_flatten, __pyx_k_Expression_flatten, sizeof(__pyx_k_Expression_flatten), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_flatten_pattern_seque, __pyx_k_Expression_flatten_pattern_seque, sizeof(__pyx_k_Expression_flatten_pattern_seque), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_flatten_pattern_seque_2, __pyx_k_Expression_flatten_pattern_seque_2, sizeof(__pyx_k_Expression_flatten_pattern_seque_2), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_flatten_sequence, __pyx_k_Expression_flatten_sequence, sizeof(__pyx_k_Expression_flatten_sequence), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_flatten_sequence_loca, __pyx_k_Expression_flatten_sequence_loca, sizeof(__pyx_k_Expression_flatten_sequence_loca), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_get_atoms, __pyx_k_Expression_get_atoms, sizeof(__pyx_k_Expression_get_atoms), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_get_attributes, __pyx_k_Expression_get_attributes, sizeof(__pyx_k_Expression_get_attributes), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_get_attributes_locals, __pyx_k_Expression_get_attributes_locals, sizeof(__pyx_k_Expression_get_attributes_locals), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_get_head, __pyx_k_Expression_get_head, sizeof(__pyx_k_Expression_get_head), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_get_leaves, __pyx_k_Expression_get_leaves, sizeof(__pyx_k_Expression_get_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_get_lookup_name, __pyx_k_Expression_get_lookup_name, sizeof(__pyx_k_Expression_get_lookup_name), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_get_mutable_leaves, __pyx_k_Expression_get_mutable_leaves, sizeof(__pyx_k_Expression_get_mutable_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_get_sort_key, __pyx_k_Expression_get_sort_key, sizeof(__pyx_k_Expression_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_get_sort_key_locals_g, __pyx_k_Expression_get_sort_key_locals_g, sizeof(__pyx_k_Expression_get_sort_key_locals_g), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_has_changed, __pyx_k_Expression_has_changed, sizeof(__pyx_k_Expression_has_changed), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_has_form, __pyx_k_Expression_has_form, sizeof(__pyx_k_Expression_has_form), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_has_symbol, __pyx_k_Expression_has_symbol, sizeof(__pyx_k_Expression_has_symbol), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_has_symbol_locals_gen, __pyx_k_Expression_has_symbol_locals_gen, sizeof(__pyx_k_Expression_has_symbol_locals_gen), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_head, __pyx_k_Expression_head, sizeof(__pyx_k_Expression_head), 0, 0, 1, 1},
  {&__pyx_kp_u_Expression_head_is_write_protect, __pyx_k_Expression_head_is_write_protect, sizeof(__pyx_k_Expression_head_is_write_protect), 0, 1, 0, 0},
  {&__pyx_n_s_Expression_is_numeric, __pyx_k_Expression_is_numeric, sizeof(__pyx_k_Expression_is_numeric), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_is_numeric_locals_gen, __pyx_k_Expression_is_numeric_locals_gen, sizeof(__pyx_k_Expression_is_numeric_locals_gen), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_leaves, __pyx_k_Expression_leaves, sizeof(__pyx_k_Expression_leaves), 0, 0, 1, 1},
  {&__pyx_kp_u_Expression_leaves_is_write_prote, __pyx_k_Expression_leaves_is_write_prote, sizeof(__pyx_k_Expression_leaves_is_write_prote), 0, 1, 0, 0},
  {&__pyx_n_s_Expression_numerify, __pyx_k_Expression_numerify, sizeof(__pyx_k_Expression_numerify), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_process_style_box, __pyx_k_Expression_process_style_box, sizeof(__pyx_k_Expression_process_style_box), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_replace_slots, __pyx_k_Expression_replace_slots, sizeof(__pyx_k_Expression_replace_slots), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_replace_vars, __pyx_k_Expression_replace_vars, sizeof(__pyx_k_Expression_replace_vars), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_replace_vars_locals_g, __pyx_k_Expression_replace_vars_locals_g, sizeof(__pyx_k_Expression_replace_vars_locals_g), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_restructure, __pyx_k_Expression_restructure, sizeof(__pyx_k_Expression_restructure), 0, 0, 1, 1},
  {&__pyx_kp_u_Expression_s, __pyx_k_Expression_s, sizeof(__pyx_k_Expression_s), 0, 1, 0, 0},
  {&__pyx_n_s_Expression_sameQ, __pyx_k_Expression_sameQ, sizeof(__pyx_k_Expression_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_sequences, __pyx_k_Expression_sequences, sizeof(__pyx_k_Expression_sequences), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_set_head, __pyx_k_Expression_set_head, sizeof(__pyx_k_Expression_set_head), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_set_leaf, __pyx_k_Expression_set_leaf, sizeof(__pyx_k_Expression_set_leaf), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_set_positions, __pyx_k_Expression_set_positions, sizeof(__pyx_k_Expression_set_positions), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_set_reordered_leaves, __pyx_k_Expression_set_reordered_leaves, sizeof(__pyx_k_Expression_set_reordered_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_shallow_copy, __pyx_k_Expression_shallow_copy, sizeof(__pyx_k_Expression_shallow_copy), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_slice, __pyx_k_Expression_slice, sizeof(__pyx_k_Expression_slice), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_sort, __pyx_k_Expression_sort, sizeof(__pyx_k_Expression_sort), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_sort_locals_lambda, __pyx_k_Expression_sort_locals_lambda, sizeof(__pyx_k_Expression_sort_locals_lambda), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_thread, __pyx_k_Expression_thread, sizeof(__pyx_k_Expression_thread), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_to_python, __pyx_k_Expression_to_python, sizeof(__pyx_k_Expression_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_to_sympy, __pyx_k_Expression_to_sympy, sizeof(__pyx_k_Expression_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_Expression_user_hash, __pyx_k_Expression_user_hash, sizeof(__pyx_k_Expression_user_hash), 0, 0, 1, 1},
  {&__pyx_kp_u_Failed, __pyx_k_Failed, sizeof(__pyx_k_Failed), 0, 1, 0, 0},
  {&__pyx_n_u_False, __pyx_k_False, sizeof(__pyx_k_False), 0, 1, 0, 1},
  {&__pyx_n_s_Float, __pyx_k_Float, sizeof(__pyx_k_Float), 0, 0, 1, 1},
  {&__pyx_n_u_Floor, __pyx_k_Floor, sizeof(__pyx_k_Floor), 0, 1, 0, 1},
  {&__pyx_n_u_Form, __pyx_k_Form, sizeof(__pyx_k_Form), 0, 1, 0, 1},
  {&__pyx_n_u_FractionBox, __pyx_k_FractionBox, sizeof(__pyx_k_FractionBox), 0, 1, 0, 1},
  {&__pyx_n_u_FullForm, __pyx_k_FullForm, sizeof(__pyx_k_FullForm), 0, 1, 0, 1},
  {&__pyx_n_s_Function, __pyx_k_Function, sizeof(__pyx_k_Function), 0, 0, 1, 1},
  {&__pyx_n_u_Function, __pyx_k_Function, sizeof(__pyx_k_Function), 0, 1, 0, 1},
  {&__pyx_kp_u_Global, __pyx_k_Global, sizeof(__pyx_k_Global), 0, 1, 0, 0},
  {&__pyx_n_u_GoldenRatio, __pyx_k_GoldenRatio, sizeof(__pyx_k_GoldenRatio), 0, 1, 0, 1},
  {&__pyx_n_u_HoldForm, __pyx_k_HoldForm, sizeof(__pyx_k_HoldForm), 0, 1, 0, 1},
  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
  {&__pyx_n_u_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 1, 0, 1},
  {&__pyx_n_u_Infinity, __pyx_k_Infinity, sizeof(__pyx_k_Infinity), 0, 1, 0, 1},
  {&__pyx_n_u_InputForm, __pyx_k_InputForm, sizeof(__pyx_k_InputForm), 0, 1, 0, 1},
  {&__pyx_n_s_Integer, __pyx_k_Integer, sizeof(__pyx_k_Integer), 0, 0, 1, 1},
  {&__pyx_n_u_Integer, __pyx_k_Integer, sizeof(__pyx_k_Integer), 0, 1, 0, 1},
  {&__pyx_n_s_Integer0, __pyx_k_Integer0, sizeof(__pyx_k_Integer0), 0, 0, 1, 1},
  {&__pyx_n_s_Integer1, __pyx_k_Integer1, sizeof(__pyx_k_Integer1), 0, 0, 1, 1},
  {&__pyx_n_s_Integer___getnewargs, __pyx_k_Integer___getnewargs, sizeof(__pyx_k_Integer___getnewargs), 0, 0, 1, 1},
  {&__pyx_n_s_Integer___hash, __pyx_k_Integer___hash, sizeof(__pyx_k_Integer___hash), 0, 0, 1, 1},
  {&__pyx_n_s_Integer___init, __pyx_k_Integer___init, sizeof(__pyx_k_Integer___init), 0, 0, 1, 1},
  {&__pyx_n_s_Integer___neg, __pyx_k_Integer___neg, sizeof(__pyx_k_Integer___neg), 0, 0, 1, 1},
  {&__pyx_n_s_Integer___new, __pyx_k_Integer___new, sizeof(__pyx_k_Integer___new), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_atom_to_boxes, __pyx_k_Integer_atom_to_boxes, sizeof(__pyx_k_Integer_atom_to_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_boxes_to_mathml, __pyx_k_Integer_boxes_to_mathml, sizeof(__pyx_k_Integer_boxes_to_mathml), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_boxes_to_tex, __pyx_k_Integer_boxes_to_tex, sizeof(__pyx_k_Integer_boxes_to_tex), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_boxes_to_text, __pyx_k_Integer_boxes_to_text, sizeof(__pyx_k_Integer_boxes_to_text), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_default_format, __pyx_k_Integer_default_format, sizeof(__pyx_k_Integer_default_format), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_do_copy, __pyx_k_Integer_do_copy, sizeof(__pyx_k_Integer_do_copy), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_evaluate, __pyx_k_Integer_evaluate, sizeof(__pyx_k_Integer_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_get_int_value, __pyx_k_Integer_get_int_value, sizeof(__pyx_k_Integer_get_int_value), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_get_sort_key, __pyx_k_Integer_get_sort_key, sizeof(__pyx_k_Integer_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_is_zero, __pyx_k_Integer_is_zero, sizeof(__pyx_k_Integer_is_zero), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_make_boxes, __pyx_k_Integer_make_boxes, sizeof(__pyx_k_Integer_make_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_round, __pyx_k_Integer_round, sizeof(__pyx_k_Integer_round), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_sameQ, __pyx_k_Integer_sameQ, sizeof(__pyx_k_Integer_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_to_mpmath, __pyx_k_Integer_to_mpmath, sizeof(__pyx_k_Integer_to_mpmath), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_to_python, __pyx_k_Integer_to_python, sizeof(__pyx_k_Integer_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_to_sympy, __pyx_k_Integer_to_sympy, sizeof(__pyx_k_Integer_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_Integer_user_hash, __pyx_k_Integer_user_hash, sizeof(__pyx_k_Integer_user_hash), 0, 0, 1, 1},
  {&__pyx_kp_u_IterationLimit, __pyx_k_IterationLimit, sizeof(__pyx_k_IterationLimit), 0, 1, 0, 0},
  {&__pyx_n_s_KeyComparable, __pyx_k_KeyComparable, sizeof(__pyx_k_KeyComparable), 0, 0, 1, 1},
  {&__pyx_n_s_KeyComparable___eq, __pyx_k_KeyComparable___eq, sizeof(__pyx_k_KeyComparable___eq), 0, 0, 1, 1},
  {&__pyx_n_s_KeyComparable___ge, __pyx_k_KeyComparable___ge, sizeof(__pyx_k_KeyComparable___ge), 0, 0, 1, 1},
  {&__pyx_n_s_KeyComparable___gt, __pyx_k_KeyComparable___gt, sizeof(__pyx_k_KeyComparable___gt), 0, 0, 1, 1},
  {&__pyx_n_s_KeyComparable___le, __pyx_k_KeyComparable___le, sizeof(__pyx_k_KeyComparable___le), 0, 0, 1, 1},
  {&__pyx_n_s_KeyComparable___lt, __pyx_k_KeyComparable___lt, sizeof(__pyx_k_KeyComparable___lt), 0, 0, 1, 1},
  {&__pyx_n_s_KeyComparable___ne, __pyx_k_KeyComparable___ne, sizeof(__pyx_k_KeyComparable___ne), 0, 0, 1, 1},
  {&__pyx_n_s_KeyComparable_get_sort_key, __pyx_k_KeyComparable_get_sort_key, sizeof(__pyx_k_KeyComparable_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_s_LinkedStructure, __pyx_k_LinkedStructure, sizeof(__pyx_k_LinkedStructure), 0, 0, 1, 1},
  {&__pyx_n_s_LinkedStructure___call, __pyx_k_LinkedStructure___call, sizeof(__pyx_k_LinkedStructure___call), 0, 0, 1, 1},
  {&__pyx_n_s_LinkedStructure___init, __pyx_k_LinkedStructure___init, sizeof(__pyx_k_LinkedStructure___init), 0, 0, 1, 1},
  {&__pyx_n_s_LinkedStructure_filter, __pyx_k_LinkedStructure_filter, sizeof(__pyx_k_LinkedStructure_filter), 0, 0, 1, 1},
  {&__pyx_n_s_LinkedStructure_slice, __pyx_k_LinkedStructure_slice, sizeof(__pyx_k_LinkedStructure_slice), 0, 0, 1, 1},
  {&__pyx_n_s_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 0, 1, 1},
  {&__pyx_n_u_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 1, 0, 1},
  {&__pyx_n_u_MachinePrecision, __pyx_k_MachinePrecision, sizeof(__pyx_k_MachinePrecision), 0, 1, 0, 1},
  {&__pyx_n_s_MachineReal, __pyx_k_MachineReal, sizeof(__pyx_k_MachineReal), 0, 0, 1, 1},
  {&__pyx_n_u_MachineReal, __pyx_k_MachineReal, sizeof(__pyx_k_MachineReal), 0, 1, 0, 1},
  {&__pyx_n_s_MachineReal___getnewargs, __pyx_k_MachineReal___getnewargs, sizeof(__pyx_k_MachineReal___getnewargs), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal___neg, __pyx_k_MachineReal___neg, sizeof(__pyx_k_MachineReal___neg), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal___new, __pyx_k_MachineReal___new, sizeof(__pyx_k_MachineReal___new), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_do_copy, __pyx_k_MachineReal_do_copy, sizeof(__pyx_k_MachineReal_do_copy), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_get_float_value, __pyx_k_MachineReal_get_float_value, sizeof(__pyx_k_MachineReal_get_float_value), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_get_precision, __pyx_k_MachineReal_get_precision, sizeof(__pyx_k_MachineReal_get_precision), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_is_approx_zero, __pyx_k_MachineReal_is_approx_zero, sizeof(__pyx_k_MachineReal_is_approx_zero), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_is_machine_precision, __pyx_k_MachineReal_is_machine_precision, sizeof(__pyx_k_MachineReal_is_machine_precision), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_is_zero, __pyx_k_MachineReal_is_zero, sizeof(__pyx_k_MachineReal_is_zero), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_make_boxes, __pyx_k_MachineReal_make_boxes, sizeof(__pyx_k_MachineReal_make_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_round, __pyx_k_MachineReal_round, sizeof(__pyx_k_MachineReal_round), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_sameQ, __pyx_k_MachineReal_sameQ, sizeof(__pyx_k_MachineReal_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_to_mpmath, __pyx_k_MachineReal_to_mpmath, sizeof(__pyx_k_MachineReal_to_mpmath), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_to_python, __pyx_k_MachineReal_to_python, sizeof(__pyx_k_MachineReal_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_MachineReal_to_sympy, __pyx_k_MachineReal_to_sympy, sizeof(__pyx_k_MachineReal_to_sympy), 0, 0, 1, 1},
  {&__pyx_kp_s_Machine_precision_real_number_S, __pyx_k_Machine_precision_real_number_S, sizeof(__pyx_k_Machine_precision_real_number_S), 0, 0, 1, 0},
  {&__pyx_n_u_MakeBoxes, __pyx_k_MakeBoxes, sizeof(__pyx_k_MakeBoxes), 0, 1, 0, 1},
  {&__pyx_n_u_MathMLForm, __pyx_k_MathMLForm, sizeof(__pyx_k_MathMLForm), 0, 1, 0, 1},
  {&__pyx_n_u_Minus, __pyx_k_Minus, sizeof(__pyx_k_Minus), 0, 1, 0, 1},
  {&__pyx_n_s_Monomial, __pyx_k_Monomial, sizeof(__pyx_k_Monomial), 0, 0, 1, 1},
  {&__pyx_n_s_Monomial___cmp, __pyx_k_Monomial___cmp, sizeof(__pyx_k_Monomial___cmp), 0, 0, 1, 1},
  {&__pyx_n_s_Monomial___cmp_locals_genexpr, __pyx_k_Monomial___cmp_locals_genexpr, sizeof(__pyx_k_Monomial___cmp_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_Monomial___eq, __pyx_k_Monomial___eq, sizeof(__pyx_k_Monomial___eq), 0, 0, 1, 1},
  {&__pyx_n_s_Monomial___ge, __pyx_k_Monomial___ge, sizeof(__pyx_k_Monomial___ge), 0, 0, 1, 1},
  {&__pyx_n_s_Monomial___gt, __pyx_k_Monomial___gt, sizeof(__pyx_k_Monomial___gt), 0, 0, 1, 1},
  {&__pyx_n_s_Monomial___init, __pyx_k_Monomial___init, sizeof(__pyx_k_Monomial___init), 0, 0, 1, 1},
  {&__pyx_n_s_Monomial___le, __pyx_k_Monomial___le, sizeof(__pyx_k_Monomial___le), 0, 0, 1, 1},
  {&__pyx_n_s_Monomial___lt, __pyx_k_Monomial___lt, sizeof(__pyx_k_Monomial___lt), 0, 0, 1, 1},
  {&__pyx_n_s_Monomial___ne, __pyx_k_Monomial___ne, sizeof(__pyx_k_Monomial___ne), 0, 0, 1, 1},
  {&__pyx_n_s_Monomial__cmp, __pyx_k_Monomial__cmp, sizeof(__pyx_k_Monomial__cmp), 0, 0, 1, 1},
  {&__pyx_n_u_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 1, 0, 1},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_u_Null, __pyx_k_Null, sizeof(__pyx_k_Null), 0, 1, 0, 1},
  {&__pyx_n_s_Number, __pyx_k_Number, sizeof(__pyx_k_Number), 0, 0, 1, 1},
  {&__pyx_n_s_NumberFormat, __pyx_k_NumberFormat, sizeof(__pyx_k_NumberFormat), 0, 0, 1, 1},
  {&__pyx_n_u_NumberFormat_2, __pyx_k_NumberFormat_2, sizeof(__pyx_k_NumberFormat_2), 0, 1, 0, 1},
  {&__pyx_n_u_NumberMultiplier, __pyx_k_NumberMultiplier, sizeof(__pyx_k_NumberMultiplier), 0, 1, 0, 1},
  {&__pyx_n_u_NumberPadding, __pyx_k_NumberPadding, sizeof(__pyx_k_NumberPadding), 0, 1, 0, 1},
  {&__pyx_n_u_NumberPoint, __pyx_k_NumberPoint, sizeof(__pyx_k_NumberPoint), 0, 1, 0, 1},
  {&__pyx_n_u_NumberSigns, __pyx_k_NumberSigns, sizeof(__pyx_k_NumberSigns), 0, 1, 0, 1},
  {&__pyx_n_s_NumberSymbol, __pyx_k_NumberSymbol, sizeof(__pyx_k_NumberSymbol), 0, 0, 1, 1},
  {&__pyx_n_s_Number___str, __pyx_k_Number___str, sizeof(__pyx_k_Number___str), 0, 0, 1, 1},
  {&__pyx_n_s_Number_is_numeric, __pyx_k_Number_is_numeric, sizeof(__pyx_k_Number_is_numeric), 0, 0, 1, 1},
  {&__pyx_n_s_Optional, __pyx_k_Optional, sizeof(__pyx_k_Optional), 0, 0, 1, 1},
  {&__pyx_n_u_OutputForm, __pyx_k_OutputForm, sizeof(__pyx_k_OutputForm), 0, 1, 0, 1},
  {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1},
  {&__pyx_n_u_Pi, __pyx_k_Pi, sizeof(__pyx_k_Pi), 0, 1, 0, 1},
  {&__pyx_n_u_Plus, __pyx_k_Plus, sizeof(__pyx_k_Plus), 0, 1, 0, 1},
  {&__pyx_n_u_Power, __pyx_k_Power, sizeof(__pyx_k_Power), 0, 1, 0, 1},
  {&__pyx_n_s_PrecisionReal, __pyx_k_PrecisionReal, sizeof(__pyx_k_PrecisionReal), 0, 0, 1, 1},
  {&__pyx_n_u_PrecisionReal, __pyx_k_PrecisionReal, sizeof(__pyx_k_PrecisionReal), 0, 1, 0, 1},
  {&__pyx_n_s_PrecisionReal___getnewargs, __pyx_k_PrecisionReal___getnewargs, sizeof(__pyx_k_PrecisionReal___getnewargs), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal___neg, __pyx_k_PrecisionReal___neg, sizeof(__pyx_k_PrecisionReal___neg), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal___new, __pyx_k_PrecisionReal___new, sizeof(__pyx_k_PrecisionReal___new), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal_do_copy, __pyx_k_PrecisionReal_do_copy, sizeof(__pyx_k_PrecisionReal_do_copy), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal_get_precision, __pyx_k_PrecisionReal_get_precision, sizeof(__pyx_k_PrecisionReal_get_precision), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal_is_zero, __pyx_k_PrecisionReal_is_zero, sizeof(__pyx_k_PrecisionReal_is_zero), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal_make_boxes, __pyx_k_PrecisionReal_make_boxes, sizeof(__pyx_k_PrecisionReal_make_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal_round, __pyx_k_PrecisionReal_round, sizeof(__pyx_k_PrecisionReal_round), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal_sameQ, __pyx_k_PrecisionReal_sameQ, sizeof(__pyx_k_PrecisionReal_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal_to_mpmath, __pyx_k_PrecisionReal_to_mpmath, sizeof(__pyx_k_PrecisionReal_to_mpmath), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal_to_python, __pyx_k_PrecisionReal_to_python, sizeof(__pyx_k_PrecisionReal_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_PrecisionReal_to_sympy, __pyx_k_PrecisionReal_to_sympy, sizeof(__pyx_k_PrecisionReal_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_Rational, __pyx_k_Rational, sizeof(__pyx_k_Rational), 0, 0, 1, 1},
  {&__pyx_n_u_Rational, __pyx_k_Rational, sizeof(__pyx_k_Rational), 0, 1, 0, 1},
  {&__pyx_n_s_RationalOneHalf, __pyx_k_RationalOneHalf, sizeof(__pyx_k_RationalOneHalf), 0, 0, 1, 1},
  {&__pyx_n_s_Rational___getnewargs, __pyx_k_Rational___getnewargs, sizeof(__pyx_k_Rational___getnewargs), 0, 0, 1, 1},
  {&__pyx_n_s_Rational___hash, __pyx_k_Rational___hash, sizeof(__pyx_k_Rational___hash), 0, 0, 1, 1},
  {&__pyx_n_s_Rational___neg, __pyx_k_Rational___neg, sizeof(__pyx_k_Rational___neg), 0, 0, 1, 1},
  {&__pyx_n_s_Rational___new, __pyx_k_Rational___new, sizeof(__pyx_k_Rational___new), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_atom_to_boxes, __pyx_k_Rational_atom_to_boxes, sizeof(__pyx_k_Rational_atom_to_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_default_format, __pyx_k_Rational_default_format, sizeof(__pyx_k_Rational_default_format), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_denominator, __pyx_k_Rational_denominator, sizeof(__pyx_k_Rational_denominator), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_do_copy, __pyx_k_Rational_do_copy, sizeof(__pyx_k_Rational_do_copy), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_do_format, __pyx_k_Rational_do_format, sizeof(__pyx_k_Rational_do_format), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_evaluate, __pyx_k_Rational_evaluate, sizeof(__pyx_k_Rational_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_get_sort_key, __pyx_k_Rational_get_sort_key, sizeof(__pyx_k_Rational_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_is_zero, __pyx_k_Rational_is_zero, sizeof(__pyx_k_Rational_is_zero), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_numerator, __pyx_k_Rational_numerator, sizeof(__pyx_k_Rational_numerator), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_round, __pyx_k_Rational_round, sizeof(__pyx_k_Rational_round), 0, 0, 1, 1},
  {&__pyx_kp_u_Rational_s_s, __pyx_k_Rational_s_s, sizeof(__pyx_k_Rational_s_s), 0, 1, 0, 0},
  {&__pyx_n_s_Rational_sameQ, __pyx_k_Rational_sameQ, sizeof(__pyx_k_Rational_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_to_mpmath, __pyx_k_Rational_to_mpmath, sizeof(__pyx_k_Rational_to_mpmath), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_to_python, __pyx_k_Rational_to_python, sizeof(__pyx_k_Rational_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_to_sympy, __pyx_k_Rational_to_sympy, sizeof(__pyx_k_Rational_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_Rational_user_hash, __pyx_k_Rational_user_hash, sizeof(__pyx_k_Rational_user_hash), 0, 0, 1, 1},
  {&__pyx_n_s_Real, __pyx_k_Real, sizeof(__pyx_k_Real), 0, 0, 1, 1},
  {&__pyx_n_u_Real, __pyx_k_Real, sizeof(__pyx_k_Real), 0, 1, 0, 1},
  {&__pyx_n_s_Real___eq, __pyx_k_Real___eq, sizeof(__pyx_k_Real___eq), 0, 0, 1, 1},
  {&__pyx_n_s_Real___hash, __pyx_k_Real___hash, sizeof(__pyx_k_Real___hash), 0, 0, 1, 1},
  {&__pyx_n_s_Real___ne, __pyx_k_Real___ne, sizeof(__pyx_k_Real___ne), 0, 0, 1, 1},
  {&__pyx_n_s_Real___new, __pyx_k_Real___new, sizeof(__pyx_k_Real___new), 0, 0, 1, 1},
  {&__pyx_n_s_Real_atom_to_boxes, __pyx_k_Real_atom_to_boxes, sizeof(__pyx_k_Real_atom_to_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_Real_boxes_to_mathml, __pyx_k_Real_boxes_to_mathml, sizeof(__pyx_k_Real_boxes_to_mathml), 0, 0, 1, 1},
  {&__pyx_n_s_Real_boxes_to_tex, __pyx_k_Real_boxes_to_tex, sizeof(__pyx_k_Real_boxes_to_tex), 0, 0, 1, 1},
  {&__pyx_n_s_Real_boxes_to_text, __pyx_k_Real_boxes_to_text, sizeof(__pyx_k_Real_boxes_to_text), 0, 0, 1, 1},
  {&__pyx_n_s_Real_evaluate, __pyx_k_Real_evaluate, sizeof(__pyx_k_Real_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_Real_get_atom_name, __pyx_k_Real_get_atom_name, sizeof(__pyx_k_Real_get_atom_name), 0, 0, 1, 1},
  {&__pyx_n_s_Real_get_sort_key, __pyx_k_Real_get_sort_key, sizeof(__pyx_k_Real_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_s_Real_user_hash, __pyx_k_Real_user_hash, sizeof(__pyx_k_Real_user_hash), 0, 0, 1, 1},
  {&__pyx_n_s_ReturnInterrupt, __pyx_k_ReturnInterrupt, sizeof(__pyx_k_ReturnInterrupt), 0, 0, 1, 1},
  {&__pyx_n_u_RowBox, __pyx_k_RowBox, sizeof(__pyx_k_RowBox), 0, 1, 0, 1},
  {&__pyx_n_s_Rule, __pyx_k_Rule, sizeof(__pyx_k_Rule), 0, 0, 1, 1},
  {&__pyx_n_u_Rule, __pyx_k_Rule, sizeof(__pyx_k_Rule), 0, 1, 0, 1},
  {&__pyx_n_u_RuleDelayed, __pyx_k_RuleDelayed, sizeof(__pyx_k_RuleDelayed), 0, 1, 0, 1},
  {&__pyx_n_u_Sequence, __pyx_k_Sequence, sizeof(__pyx_k_Sequence), 0, 1, 0, 1},
  {&__pyx_n_u_SignPadding, __pyx_k_SignPadding, sizeof(__pyx_k_SignPadding), 0, 1, 0, 1},
  {&__pyx_n_u_Sin, __pyx_k_Sin, sizeof(__pyx_k_Sin), 0, 1, 0, 1},
  {&__pyx_n_u_Slot, __pyx_k_Slot, sizeof(__pyx_k_Slot), 0, 1, 0, 1},
  {&__pyx_n_u_SlotSequence, __pyx_k_SlotSequence, sizeof(__pyx_k_SlotSequence), 0, 1, 0, 1},
  {&__pyx_n_u_Sqrt, __pyx_k_Sqrt, sizeof(__pyx_k_Sqrt), 0, 1, 0, 1},
  {&__pyx_n_u_StandardForm, __pyx_k_StandardForm, sizeof(__pyx_k_StandardForm), 0, 1, 0, 1},
  {&__pyx_n_s_String, __pyx_k_String, sizeof(__pyx_k_String), 0, 0, 1, 1},
  {&__pyx_n_u_String, __pyx_k_String, sizeof(__pyx_k_String), 0, 1, 0, 1},
  {&__pyx_n_s_StringFromPython, __pyx_k_StringFromPython, sizeof(__pyx_k_StringFromPython), 0, 0, 1, 1},
  {&__pyx_n_s_StringFromPython___new, __pyx_k_StringFromPython___new, sizeof(__pyx_k_StringFromPython___new), 0, 0, 1, 1},
  {&__pyx_n_s_String___getnewargs, __pyx_k_String___getnewargs, sizeof(__pyx_k_String___getnewargs), 0, 0, 1, 1},
  {&__pyx_n_s_String___hash, __pyx_k_String___hash, sizeof(__pyx_k_String___hash), 0, 0, 1, 1},
  {&__pyx_n_s_String___new, __pyx_k_String___new, sizeof(__pyx_k_String___new), 0, 0, 1, 1},
  {&__pyx_n_s_String___str, __pyx_k_String___str, sizeof(__pyx_k_String___str), 0, 0, 1, 1},
  {&__pyx_n_s_String_atom_to_boxes, __pyx_k_String_atom_to_boxes, sizeof(__pyx_k_String_atom_to_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_String_boxes_to_mathml, __pyx_k_String_boxes_to_mathml, sizeof(__pyx_k_String_boxes_to_mathml), 0, 0, 1, 1},
  {&__pyx_n_s_String_boxes_to_mathml_locals_re, __pyx_k_String_boxes_to_mathml_locals_re, sizeof(__pyx_k_String_boxes_to_mathml_locals_re), 0, 0, 1, 1},
  {&__pyx_n_s_String_boxes_to_tex, __pyx_k_String_boxes_to_tex, sizeof(__pyx_k_String_boxes_to_tex), 0, 0, 1, 1},
  {&__pyx_n_s_String_boxes_to_tex_locals_rende, __pyx_k_String_boxes_to_tex_locals_rende, sizeof(__pyx_k_String_boxes_to_tex_locals_rende), 0, 0, 1, 1},
  {&__pyx_n_s_String_boxes_to_text, __pyx_k_String_boxes_to_text, sizeof(__pyx_k_String_boxes_to_text), 0, 0, 1, 1},
  {&__pyx_n_s_String_default_format, __pyx_k_String_default_format, sizeof(__pyx_k_String_default_format), 0, 0, 1, 1},
  {&__pyx_n_s_String_do_copy, __pyx_k_String_do_copy, sizeof(__pyx_k_String_do_copy), 0, 0, 1, 1},
  {&__pyx_n_s_String_get_sort_key, __pyx_k_String_get_sort_key, sizeof(__pyx_k_String_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_s_String_get_string_value, __pyx_k_String_get_string_value, sizeof(__pyx_k_String_get_string_value), 0, 0, 1, 1},
  {&__pyx_n_s_String_sameQ, __pyx_k_String_sameQ, sizeof(__pyx_k_String_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_String_to_python, __pyx_k_String_to_python, sizeof(__pyx_k_String_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_String_to_sympy, __pyx_k_String_to_sympy, sizeof(__pyx_k_String_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_String_user_hash, __pyx_k_String_user_hash, sizeof(__pyx_k_String_user_hash), 0, 0, 1, 1},
  {&__pyx_n_s_Structure, __pyx_k_Structure, sizeof(__pyx_k_Structure), 0, 0, 1, 1},
  {&__pyx_n_s_Structure___call, __pyx_k_Structure___call, sizeof(__pyx_k_Structure___call), 0, 0, 1, 1},
  {&__pyx_n_s_Structure_filter, __pyx_k_Structure_filter, sizeof(__pyx_k_Structure_filter), 0, 0, 1, 1},
  {&__pyx_n_s_Structure_slice, __pyx_k_Structure_slice, sizeof(__pyx_k_Structure_slice), 0, 0, 1, 1},
  {&__pyx_kp_u_Structure_slice_only_supports_sl, __pyx_k_Structure_slice_only_supports_sl, sizeof(__pyx_k_Structure_slice_only_supports_sl), 0, 1, 0, 0},
  {&__pyx_n_u_StyleBox, __pyx_k_StyleBox, sizeof(__pyx_k_StyleBox), 0, 1, 0, 1},
  {&__pyx_n_u_Subtract, __pyx_k_Subtract, sizeof(__pyx_k_Subtract), 0, 1, 0, 1},
  {&__pyx_n_u_SuperscriptBox, __pyx_k_SuperscriptBox, sizeof(__pyx_k_SuperscriptBox), 0, 1, 0, 1},
  {&__pyx_n_s_Symbol, __pyx_k_Symbol, sizeof(__pyx_k_Symbol), 0, 0, 1, 1},
  {&__pyx_n_u_Symbol, __pyx_k_Symbol, sizeof(__pyx_k_Symbol), 0, 1, 0, 1},
  {&__pyx_n_s_SymbolAborted, __pyx_k_SymbolAborted, sizeof(__pyx_k_SymbolAborted), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolAssociation, __pyx_k_SymbolAssociation, sizeof(__pyx_k_SymbolAssociation), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolByteArray, __pyx_k_SymbolByteArray, sizeof(__pyx_k_SymbolByteArray), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolComplexInfinity, __pyx_k_SymbolComplexInfinity, sizeof(__pyx_k_SymbolComplexInfinity), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolDirectedInfinity, __pyx_k_SymbolDirectedInfinity, sizeof(__pyx_k_SymbolDirectedInfinity), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolFailed, __pyx_k_SymbolFailed, sizeof(__pyx_k_SymbolFailed), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolFalse, __pyx_k_SymbolFalse, sizeof(__pyx_k_SymbolFalse), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolInfinity, __pyx_k_SymbolInfinity, sizeof(__pyx_k_SymbolInfinity), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolList, __pyx_k_SymbolList, sizeof(__pyx_k_SymbolList), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolMakeBoxes, __pyx_k_SymbolMakeBoxes, sizeof(__pyx_k_SymbolMakeBoxes), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolN, __pyx_k_SymbolN, sizeof(__pyx_k_SymbolN), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolNull, __pyx_k_SymbolNull, sizeof(__pyx_k_SymbolNull), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolRule, __pyx_k_SymbolRule, sizeof(__pyx_k_SymbolRule), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolSequence, __pyx_k_SymbolSequence, sizeof(__pyx_k_SymbolSequence), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolTrue, __pyx_k_SymbolTrue, sizeof(__pyx_k_SymbolTrue), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolUndefined, __pyx_k_SymbolUndefined, sizeof(__pyx_k_SymbolUndefined), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol___getnewargs, __pyx_k_Symbol___getnewargs, sizeof(__pyx_k_Symbol___getnewargs), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol___hash, __pyx_k_Symbol___hash, sizeof(__pyx_k_Symbol___hash), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol___new, __pyx_k_Symbol___new, sizeof(__pyx_k_Symbol___new), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol___str, __pyx_k_Symbol___str, sizeof(__pyx_k_Symbol___str), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_atom_to_boxes, __pyx_k_Symbol_atom_to_boxes, sizeof(__pyx_k_Symbol_atom_to_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_boxes_to_text, __pyx_k_Symbol_boxes_to_text, sizeof(__pyx_k_Symbol_boxes_to_text), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_default_format, __pyx_k_Symbol_default_format, sizeof(__pyx_k_Symbol_default_format), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_do_copy, __pyx_k_Symbol_do_copy, sizeof(__pyx_k_Symbol_do_copy), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_equal2, __pyx_k_Symbol_equal2, sizeof(__pyx_k_Symbol_equal2), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_evaluate, __pyx_k_Symbol_evaluate, sizeof(__pyx_k_Symbol_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_get_attributes, __pyx_k_Symbol_get_attributes, sizeof(__pyx_k_Symbol_get_attributes), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_get_name, __pyx_k_Symbol_get_name, sizeof(__pyx_k_Symbol_get_name), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_get_sort_key, __pyx_k_Symbol_get_sort_key, sizeof(__pyx_k_Symbol_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_has_symbol, __pyx_k_Symbol_has_symbol, sizeof(__pyx_k_Symbol_has_symbol), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_is_numeric, __pyx_k_Symbol_is_numeric, sizeof(__pyx_k_Symbol_is_numeric), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_is_symbol, __pyx_k_Symbol_is_symbol, sizeof(__pyx_k_Symbol_is_symbol), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_is_true, __pyx_k_Symbol_is_true, sizeof(__pyx_k_Symbol_is_true), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_replace_vars, __pyx_k_Symbol_replace_vars, sizeof(__pyx_k_Symbol_replace_vars), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_replace_vars_locals_genex, __pyx_k_Symbol_replace_vars_locals_genex, sizeof(__pyx_k_Symbol_replace_vars_locals_genex), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_sameQ, __pyx_k_Symbol_sameQ, sizeof(__pyx_k_Symbol_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_to_python, __pyx_k_Symbol_to_python, sizeof(__pyx_k_Symbol_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_to_sympy, __pyx_k_Symbol_to_sympy, sizeof(__pyx_k_Symbol_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol_user_hash, __pyx_k_Symbol_user_hash, sizeof(__pyx_k_Symbol_user_hash), 0, 0, 1, 1},
  {&__pyx_n_s_SympyExpression, __pyx_k_SympyExpression, sizeof(__pyx_k_SympyExpression), 0, 0, 1, 1},
  {&__pyx_kp_u_System, __pyx_k_System, sizeof(__pyx_k_System), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Alternatives, __pyx_k_System_Alternatives, sizeof(__pyx_k_System_Alternatives), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Blank, __pyx_k_System_Blank, sizeof(__pyx_k_System_Blank), 0, 1, 0, 0},
  {&__pyx_kp_u_System_BlankNullSequence, __pyx_k_System_BlankNullSequence, sizeof(__pyx_k_System_BlankNullSequence), 0, 1, 0, 0},
  {&__pyx_kp_u_System_BlankSequence, __pyx_k_System_BlankSequence, sizeof(__pyx_k_System_BlankSequence), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Block, __pyx_k_System_Block, sizeof(__pyx_k_System_Block), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Compile, __pyx_k_System_Compile, sizeof(__pyx_k_System_Compile), 0, 1, 0, 0},
  {&__pyx_kp_u_System_CompiledFunction, __pyx_k_System_CompiledFunction, sizeof(__pyx_k_System_CompiledFunction), 0, 1, 0, 0},
  {&__pyx_kp_b_System_Complex, __pyx_k_System_Complex, sizeof(__pyx_k_System_Complex), 0, 0, 0, 0},
  {&__pyx_kp_u_System_Condition, __pyx_k_System_Condition, sizeof(__pyx_k_System_Condition), 0, 1, 0, 0},
  {&__pyx_kp_u_System_DefaultValues, __pyx_k_System_DefaultValues, sizeof(__pyx_k_System_DefaultValues), 0, 1, 0, 0},
  {&__pyx_kp_u_System_DirectedInfinity, __pyx_k_System_DirectedInfinity, sizeof(__pyx_k_System_DirectedInfinity), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Evaluate, __pyx_k_System_Evaluate, sizeof(__pyx_k_System_Evaluate), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Flat, __pyx_k_System_Flat, sizeof(__pyx_k_System_Flat), 0, 1, 0, 0},
  {&__pyx_kp_u_System_FractionBox, __pyx_k_System_FractionBox, sizeof(__pyx_k_System_FractionBox), 0, 1, 0, 0},
  {&__pyx_kp_u_System_FullForm, __pyx_k_System_FullForm, sizeof(__pyx_k_System_FullForm), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Function, __pyx_k_System_Function, sizeof(__pyx_k_System_Function), 0, 1, 0, 0},
  {&__pyx_kp_u_System_GraphBox, __pyx_k_System_GraphBox, sizeof(__pyx_k_System_GraphBox), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Graphics, __pyx_k_System_Graphics, sizeof(__pyx_k_System_Graphics), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Graphics3D, __pyx_k_System_Graphics3D, sizeof(__pyx_k_System_Graphics3D), 0, 1, 0, 0},
  {&__pyx_kp_u_System_HoldAll, __pyx_k_System_HoldAll, sizeof(__pyx_k_System_HoldAll), 0, 1, 0, 0},
  {&__pyx_kp_u_System_HoldAllComplete, __pyx_k_System_HoldAllComplete, sizeof(__pyx_k_System_HoldAllComplete), 0, 1, 0, 0},
  {&__pyx_kp_u_System_HoldFirst, __pyx_k_System_HoldFirst, sizeof(__pyx_k_System_HoldFirst), 0, 1, 0, 0},
  {&__pyx_kp_u_System_HoldForm, __pyx_k_System_HoldForm, sizeof(__pyx_k_System_HoldForm), 0, 1, 0, 0},
  {&__pyx_kp_u_System_HoldRest, __pyx_k_System_HoldRest, sizeof(__pyx_k_System_HoldRest), 0, 1, 0, 0},
  {&__pyx_kp_u_System_ImageSizeMultipliers, __pyx_k_System_ImageSizeMultipliers, sizeof(__pyx_k_System_ImageSizeMultipliers), 0, 1, 0, 0},
  {&__pyx_kp_u_System_InputForm, __pyx_k_System_InputForm, sizeof(__pyx_k_System_InputForm), 0, 1, 0, 0},
  {&__pyx_kp_b_System_Integer, __pyx_k_System_Integer, sizeof(__pyx_k_System_Integer), 0, 0, 0, 0},
  {&__pyx_kp_u_System_List, __pyx_k_System_List, sizeof(__pyx_k_System_List), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Listable, __pyx_k_System_Listable, sizeof(__pyx_k_System_Listable), 0, 1, 0, 0},
  {&__pyx_kp_u_System_MathMLForm, __pyx_k_System_MathMLForm, sizeof(__pyx_k_System_MathMLForm), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Module, __pyx_k_System_Module, sizeof(__pyx_k_System_Module), 0, 1, 0, 0},
  {&__pyx_kp_u_System_NumberForm, __pyx_k_System_NumberForm, sizeof(__pyx_k_System_NumberForm), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Optional, __pyx_k_System_Optional, sizeof(__pyx_k_System_Optional), 0, 1, 0, 0},
  {&__pyx_kp_u_System_OptionsPattern, __pyx_k_System_OptionsPattern, sizeof(__pyx_k_System_OptionsPattern), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Orderless, __pyx_k_System_Orderless, sizeof(__pyx_k_System_Orderless), 0, 1, 0, 0},
  {&__pyx_kp_u_System_OutputForm, __pyx_k_System_OutputForm, sizeof(__pyx_k_System_OutputForm), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Pattern, __pyx_k_System_Pattern, sizeof(__pyx_k_System_Pattern), 0, 1, 0, 0},
  {&__pyx_kp_u_System_PatternTest, __pyx_k_System_PatternTest, sizeof(__pyx_k_System_PatternTest), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Postfix, __pyx_k_System_Postfix, sizeof(__pyx_k_System_Postfix), 0, 1, 0, 0},
  {&__pyx_kp_b_System_Rational, __pyx_k_System_Rational, sizeof(__pyx_k_System_Rational), 0, 0, 0, 0},
  {&__pyx_kp_b_System_Real, __pyx_k_System_Real, sizeof(__pyx_k_System_Real), 0, 0, 0, 0},
  {&__pyx_kp_u_System_Repeated, __pyx_k_System_Repeated, sizeof(__pyx_k_System_Repeated), 0, 1, 0, 0},
  {&__pyx_kp_u_System_RepeatedNull, __pyx_k_System_RepeatedNull, sizeof(__pyx_k_System_RepeatedNull), 0, 1, 0, 0},
  {&__pyx_kp_u_System_RowBox, __pyx_k_System_RowBox, sizeof(__pyx_k_System_RowBox), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Sequence, __pyx_k_System_Sequence, sizeof(__pyx_k_System_Sequence), 0, 1, 0, 0},
  {&__pyx_kp_u_System_SequenceHold, __pyx_k_System_SequenceHold, sizeof(__pyx_k_System_SequenceHold), 0, 1, 0, 0},
  {&__pyx_kp_u_System_ShowStringCharacters, __pyx_k_System_ShowStringCharacters, sizeof(__pyx_k_System_ShowStringCharacters), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Slot, __pyx_k_System_Slot, sizeof(__pyx_k_System_Slot), 0, 1, 0, 0},
  {&__pyx_kp_u_System_SlotSequence, __pyx_k_System_SlotSequence, sizeof(__pyx_k_System_SlotSequence), 0, 1, 0, 0},
  {&__pyx_kp_u_System_SqrtBox, __pyx_k_System_SqrtBox, sizeof(__pyx_k_System_SqrtBox), 0, 1, 0, 0},
  {&__pyx_kp_u_System_StandardForm, __pyx_k_System_StandardForm, sizeof(__pyx_k_System_StandardForm), 0, 1, 0, 0},
  {&__pyx_kp_u_System_SubscriptBox, __pyx_k_System_SubscriptBox, sizeof(__pyx_k_System_SubscriptBox), 0, 1, 0, 0},
  {&__pyx_kp_u_System_SubsuperscriptBox, __pyx_k_System_SubsuperscriptBox, sizeof(__pyx_k_System_SubsuperscriptBox), 0, 1, 0, 0},
  {&__pyx_kp_u_System_SuperscriptBox, __pyx_k_System_SuperscriptBox, sizeof(__pyx_k_System_SuperscriptBox), 0, 1, 0, 0},
  {&__pyx_kp_b_System_Symbol, __pyx_k_System_Symbol, sizeof(__pyx_k_System_Symbol), 0, 0, 0, 0},
  {&__pyx_kp_u_System_TeXForm, __pyx_k_System_TeXForm, sizeof(__pyx_k_System_TeXForm), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Times, __pyx_k_System_Times, sizeof(__pyx_k_System_Times), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Verbatim, __pyx_k_System_Verbatim, sizeof(__pyx_k_System_Verbatim), 0, 1, 0, 0},
  {&__pyx_kp_u_System_With, __pyx_k_System_With, sizeof(__pyx_k_System_With), 0, 1, 0, 0},
  {&__pyx_n_s_TEX_REPLACE, __pyx_k_TEX_REPLACE, sizeof(__pyx_k_TEX_REPLACE), 0, 0, 1, 1},
  {&__pyx_n_s_TEX_REPLACE_RE, __pyx_k_TEX_REPLACE_RE, sizeof(__pyx_k_TEX_REPLACE_RE), 0, 0, 1, 1},
  {&__pyx_n_s_TEX_TEXT_REPLACE, __pyx_k_TEX_TEXT_REPLACE, sizeof(__pyx_k_TEX_TEXT_REPLACE), 0, 0, 1, 1},
  {&__pyx_n_u_TeXForm, __pyx_k_TeXForm, sizeof(__pyx_k_TeXForm), 0, 1, 0, 1},
  {&__pyx_n_u_Thread, __pyx_k_Thread, sizeof(__pyx_k_Thread), 0, 1, 0, 1},
  {&__pyx_n_u_Times, __pyx_k_Times, sizeof(__pyx_k_Times), 0, 1, 0, 1},
  {&__pyx_n_u_TraditionalForm, __pyx_k_TraditionalForm, sizeof(__pyx_k_TraditionalForm), 0, 1, 0, 1},
  {&__pyx_n_u_True, __pyx_k_True, sizeof(__pyx_k_True), 0, 1, 0, 1},
  {&__pyx_n_s_Tuple, __pyx_k_Tuple, sizeof(__pyx_k_Tuple), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_u_Undefined, __pyx_k_Undefined, sizeof(__pyx_k_Undefined), 0, 1, 0, 1},
  {&__pyx_n_u_Unevaluated, __pyx_k_Unevaluated, sizeof(__pyx_k_Unevaluated), 0, 1, 0, 1},
  {&__pyx_n_s_Union, __pyx_k_Union, sizeof(__pyx_k_Union), 0, 0, 1, 1},
  {&__pyx_kp_u_Unknown_number_type, __pyx_k_Unknown_number_type, sizeof(__pyx_k_Unknown_number_type), 0, 1, 0, 0},
  {&__pyx_n_s_UnlinkedStructure, __pyx_k_UnlinkedStructure, sizeof(__pyx_k_UnlinkedStructure), 0, 0, 1, 1},
  {&__pyx_n_s_UnlinkedStructure___call, __pyx_k_UnlinkedStructure___call, sizeof(__pyx_k_UnlinkedStructure___call), 0, 0, 1, 1},
  {&__pyx_n_s_UnlinkedStructure___init, __pyx_k_UnlinkedStructure___init, sizeof(__pyx_k_UnlinkedStructure___init), 0, 0, 1, 1},
  {&__pyx_n_s_UnlinkedStructure_filter, __pyx_k_UnlinkedStructure_filter, sizeof(__pyx_k_UnlinkedStructure_filter), 0, 0, 1, 1},
  {&__pyx_n_s_UnlinkedStructure_slice, __pyx_k_UnlinkedStructure_slice, sizeof(__pyx_k_UnlinkedStructure_slice), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_u__100, __pyx_k__100, sizeof(__pyx_k__100), 0, 1, 0, 0},
  {&__pyx_kp_u__101, __pyx_k__101, sizeof(__pyx_k__101), 0, 1, 0, 0},
  {&__pyx_kp_u__102, __pyx_k__102, sizeof(__pyx_k__102), 0, 1, 0, 0},
  {&__pyx_kp_u__103, __pyx_k__103, sizeof(__pyx_k__103), 0, 1, 0, 0},
  {&__pyx_kp_u__105, __pyx_k__105, sizeof(__pyx_k__105), 0, 1, 0, 0},
  {&__pyx_kp_u__106, __pyx_k__106, sizeof(__pyx_k__106), 0, 1, 0, 0},
  {&__pyx_kp_u__108, __pyx_k__108, sizeof(__pyx_k__108), 0, 1, 0, 0},
  {&__pyx_kp_u__111, __pyx_k__111, sizeof(__pyx_k__111), 0, 1, 0, 0},
  {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0},
  {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0},
  {&__pyx_kp_u__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 1, 0, 0},
  {&__pyx_kp_u__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 1, 0, 0},
  {&__pyx_kp_u__35, __pyx_k__35, sizeof(__pyx_k__35), 0, 1, 0, 0},
  {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0},
  {&__pyx_kp_u__42, __pyx_k__42, sizeof(__pyx_k__42), 0, 1, 0, 0},
  {&__pyx_kp_u__44, __pyx_k__44, sizeof(__pyx_k__44), 0, 1, 0, 0},
  {&__pyx_kp_u__45, __pyx_k__45, sizeof(__pyx_k__45), 0, 1, 0, 0},
  {&__pyx_kp_u__46, __pyx_k__46, sizeof(__pyx_k__46), 0, 1, 0, 0},
  {&__pyx_kp_u__48, __pyx_k__48, sizeof(__pyx_k__48), 0, 1, 0, 0},
  {&__pyx_kp_u__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0, 0},
  {&__pyx_kp_u__51, __pyx_k__51, sizeof(__pyx_k__51), 0, 1, 0, 0},
  {&__pyx_kp_u__52, __pyx_k__52, sizeof(__pyx_k__52), 0, 1, 0, 0},
  {&__pyx_kp_u__53, __pyx_k__53, sizeof(__pyx_k__53), 0, 1, 0, 0},
  {&__pyx_kp_u__532, __pyx_k__532, sizeof(__pyx_k__532), 0, 1, 0, 0},
  {&__pyx_n_u__54, __pyx_k__54, sizeof(__pyx_k__54), 0, 1, 0, 1},
  {&__pyx_kp_u__58, __pyx_k__58, sizeof(__pyx_k__58), 0, 1, 0, 0},
  {&__pyx_kp_u__59, __pyx_k__59, sizeof(__pyx_k__59), 0, 1, 0, 0},
  {&__pyx_kp_u__60, __pyx_k__60, sizeof(__pyx_k__60), 0, 1, 0, 0},
  {&__pyx_kp_u__65, __pyx_k__65, sizeof(__pyx_k__65), 0, 1, 0, 0},
  {&__pyx_kp_u__69, __pyx_k__69, sizeof(__pyx_k__69), 0, 1, 0, 0},
  {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0},
  {&__pyx_kp_u__70, __pyx_k__70, sizeof(__pyx_k__70), 0, 1, 0, 0},
  {&__pyx_kp_u__71, __pyx_k__71, sizeof(__pyx_k__71), 0, 1, 0, 0},
  {&__pyx_kp_u__73, __pyx_k__73, sizeof(__pyx_k__73), 0, 1, 0, 0},
  {&__pyx_kp_u__75, __pyx_k__75, sizeof(__pyx_k__75), 0, 1, 0, 0},
  {&__pyx_kp_u__758, __pyx_k__758, sizeof(__pyx_k__758), 0, 1, 0, 0},
  {&__pyx_kp_u__759, __pyx_k__759, sizeof(__pyx_k__759), 0, 1, 0, 0},
  {&__pyx_kp_u__760, __pyx_k__760, sizeof(__pyx_k__760), 0, 1, 0, 0},
  {&__pyx_kp_u__761, __pyx_k__761, sizeof(__pyx_k__761), 0, 1, 0, 0},
  {&__pyx_kp_u__762, __pyx_k__762, sizeof(__pyx_k__762), 0, 1, 0, 0},
  {&__pyx_kp_u__763, __pyx_k__763, sizeof(__pyx_k__763), 0, 1, 0, 0},
  {&__pyx_kp_u__764, __pyx_k__764, sizeof(__pyx_k__764), 0, 1, 0, 0},
  {&__pyx_kp_u__765, __pyx_k__765, sizeof(__pyx_k__765), 0, 1, 0, 0},
  {&__pyx_kp_u__766, __pyx_k__766, sizeof(__pyx_k__766), 0, 1, 0, 0},
  {&__pyx_kp_u__767, __pyx_k__767, sizeof(__pyx_k__767), 0, 1, 0, 0},
  {&__pyx_kp_u__768, __pyx_k__768, sizeof(__pyx_k__768), 0, 1, 0, 0},
  {&__pyx_kp_u__769, __pyx_k__769, sizeof(__pyx_k__769), 0, 1, 0, 0},
  {&__pyx_kp_u__770, __pyx_k__770, sizeof(__pyx_k__770), 0, 1, 0, 0},
  {&__pyx_kp_u__771, __pyx_k__771, sizeof(__pyx_k__771), 0, 1, 0, 0},
  {&__pyx_kp_u__772, __pyx_k__772, sizeof(__pyx_k__772), 0, 1, 0, 0},
  {&__pyx_kp_u__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 1, 0, 0},
  {&__pyx_kp_u__80, __pyx_k__80, sizeof(__pyx_k__80), 0, 1, 0, 0},
  {&__pyx_kp_u__81, __pyx_k__81, sizeof(__pyx_k__81), 0, 1, 0, 0},
  {&__pyx_kp_u__82, __pyx_k__82, sizeof(__pyx_k__82), 0, 1, 0, 0},
  {&__pyx_kp_u__88, __pyx_k__88, sizeof(__pyx_k__88), 0, 1, 0, 0},
  {&__pyx_n_u__89, __pyx_k__89, sizeof(__pyx_k__89), 0, 1, 0, 1},
  {&__pyx_kp_u__90, __pyx_k__90, sizeof(__pyx_k__90), 0, 1, 0, 0},
  {&__pyx_kp_u__94, __pyx_k__94, sizeof(__pyx_k__94), 0, 1, 0, 0},
  {&__pyx_kp_u__95, __pyx_k__95, sizeof(__pyx_k__95), 0, 1, 0, 0},
  {&__pyx_kp_u__96, __pyx_k__96, sizeof(__pyx_k__96), 0, 1, 0, 0},
  {&__pyx_kp_u__97, __pyx_k__97, sizeof(__pyx_k__97), 0, 1, 0, 0},
  {&__pyx_kp_u__98, __pyx_k__98, sizeof(__pyx_k__98), 0, 1, 0, 0},
  {&__pyx_kp_u__99, __pyx_k__99, sizeof(__pyx_k__99), 0, 1, 0, 0},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_n_s_abs, __pyx_k_abs, sizeof(__pyx_k_abs), 0, 0, 1, 1},
  {&__pyx_n_s_abs_eps, __pyx_k_abs_eps, sizeof(__pyx_k_abs_eps), 0, 0, 1, 1},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_allow_initial_backquote, __pyx_k_allow_initial_backquote, sizeof(__pyx_k_allow_initial_backquote), 0, 0, 1, 1},
  {&__pyx_n_s_allow_symbols, __pyx_k_allow_symbols, sizeof(__pyx_k_allow_symbols), 0, 0, 1, 1},
  {&__pyx_n_s_almosteq, __pyx_k_almosteq, sizeof(__pyx_k_almosteq), 0, 0, 1, 1},
  {&__pyx_kp_u_amp, __pyx_k_amp, sizeof(__pyx_k_amp), 0, 1, 0, 0},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_applied, __pyx_k_applied, sizeof(__pyx_k_applied), 0, 0, 1, 1},
  {&__pyx_n_s_apply, __pyx_k_apply, sizeof(__pyx_k_apply), 0, 0, 1, 1},
  {&__pyx_n_s_apply_leaf, __pyx_k_apply_leaf, sizeof(__pyx_k_apply_leaf), 0, 0, 1, 1},
  {&__pyx_n_s_apply_rules, __pyx_k_apply_rules, sizeof(__pyx_k_apply_rules), 0, 0, 1, 1},
  {&__pyx_n_s_arg, __pyx_k_arg, sizeof(__pyx_k_arg), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_as_numer_denom, __pyx_k_as_numer_denom, sizeof(__pyx_k_as_numer_denom), 0, 0, 1, 1},
  {&__pyx_n_s_as_sympy_function, __pyx_k_as_sympy_function, sizeof(__pyx_k_as_sympy_function), 0, 0, 1, 1},
  {&__pyx_n_s_atom, __pyx_k_atom, sizeof(__pyx_k_atom), 0, 0, 1, 1},
  {&__pyx_n_s_atom_list_constructor, __pyx_k_atom_list_constructor, sizeof(__pyx_k_atom_list_constructor), 0, 0, 1, 1},
  {&__pyx_n_s_atom_list_constructor_locals_con, __pyx_k_atom_list_constructor_locals_con, sizeof(__pyx_k_atom_list_constructor_locals_con), 0, 0, 1, 1},
  {&__pyx_n_s_atom_list_constructor_locals_gen, __pyx_k_atom_list_constructor_locals_gen, sizeof(__pyx_k_atom_list_constructor_locals_gen), 0, 0, 1, 1},
  {&__pyx_n_s_atom_names, __pyx_k_atom_names, sizeof(__pyx_k_atom_names), 0, 0, 1, 1},
  {&__pyx_n_s_atom_to_boxes, __pyx_k_atom_to_boxes, sizeof(__pyx_k_atom_to_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_atoms, __pyx_k_atoms, sizeof(__pyx_k_atoms), 0, 0, 1, 1},
  {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_b64decode, __pyx_k_b64decode, sizeof(__pyx_k_b64decode), 0, 0, 1, 1},
  {&__pyx_n_s_b64encode, __pyx_k_b64encode, sizeof(__pyx_k_b64encode), 0, 0, 1, 1},
  {&__pyx_kp_u_backslash, __pyx_k_backslash, sizeof(__pyx_k_backslash), 0, 1, 0, 0},
  {&__pyx_kp_u_backslash_2, __pyx_k_backslash_2, sizeof(__pyx_k_backslash_2), 0, 1, 0, 0},
  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  {&__pyx_n_s_base64, __pyx_k_base64, sizeof(__pyx_k_base64), 0, 0, 1, 1},
  {&__pyx_n_s_bisect, __pyx_k_bisect, sizeof(__pyx_k_bisect), 0, 0, 1, 1},
  {&__pyx_n_s_bisect_left, __pyx_k_bisect_left, sizeof(__pyx_k_bisect_left), 0, 0, 1, 1},
  {&__pyx_n_s_block, __pyx_k_block, sizeof(__pyx_k_block), 0, 0, 1, 1},
  {&__pyx_n_s_body, __pyx_k_body, sizeof(__pyx_k_body), 0, 0, 1, 1},
  {&__pyx_n_s_box, __pyx_k_box, sizeof(__pyx_k_box), 0, 0, 1, 1},
  {&__pyx_n_s_boxes_to_mathml, __pyx_k_boxes_to_mathml, sizeof(__pyx_k_boxes_to_mathml), 0, 0, 1, 1},
  {&__pyx_n_s_boxes_to_tex, __pyx_k_boxes_to_tex, sizeof(__pyx_k_boxes_to_tex), 0, 0, 1, 1},
  {&__pyx_n_s_boxes_to_text, __pyx_k_boxes_to_text, sizeof(__pyx_k_boxes_to_text), 0, 0, 1, 1},
  {&__pyx_n_s_builtin, __pyx_k_builtin, sizeof(__pyx_k_builtin), 0, 0, 1, 1},
  {&__pyx_n_s_builtins, __pyx_k_builtins, sizeof(__pyx_k_builtins), 0, 0, 1, 1},
  {&__pyx_n_s_builtins_by_module, __pyx_k_builtins_by_module, sizeof(__pyx_k_builtins_by_module), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
  {&__pyx_n_s_cache, __pyx_k_cache, sizeof(__pyx_k_cache), 0, 0, 1, 1},
  {&__pyx_n_s_cache_2, __pyx_k_cache_2, sizeof(__pyx_k_cache_2), 0, 0, 1, 1},
  {&__pyx_n_s_call, __pyx_k_call, sizeof(__pyx_k_call), 0, 0, 1, 1},
  {&__pyx_n_s_callback, __pyx_k_callback, sizeof(__pyx_k_callback), 0, 0, 1, 1},
  {&__pyx_kp_u_cannot_be_formatted_as, __pyx_k_cannot_be_formatted_as, sizeof(__pyx_k_cannot_be_formatted_as), 0, 1, 0, 0},
  {&__pyx_n_s_cfunc, __pyx_k_cfunc, sizeof(__pyx_k_cfunc), 0, 0, 1, 1},
  {&__pyx_n_s_chain, __pyx_k_chain, sizeof(__pyx_k_chain), 0, 0, 1, 1},
  {&__pyx_n_s_check_stopped, __pyx_k_check_stopped, sizeof(__pyx_k_check_stopped), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_clear_cache, __pyx_k_clear_cache, sizeof(__pyx_k_clear_cache), 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_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1},
  {&__pyx_n_s_cmp, __pyx_k_cmp, sizeof(__pyx_k_cmp), 0, 0, 1, 1},
  {&__pyx_n_s_compile, __pyx_k_compile, sizeof(__pyx_k_compile), 0, 0, 1, 1},
  {&__pyx_n_s_compiled, __pyx_k_compiled, sizeof(__pyx_k_compiled), 0, 0, 1, 1},
  {&__pyx_n_s_cond, __pyx_k_cond, sizeof(__pyx_k_cond), 0, 0, 1, 1},
  {&__pyx_n_s_construct, __pyx_k_construct, sizeof(__pyx_k_construct), 0, 0, 1, 1},
  {&__pyx_n_s_content, __pyx_k_content, sizeof(__pyx_k_content), 0, 0, 1, 1},
  {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
  {&__pyx_n_u_convert_all_global_functions, __pyx_k_convert_all_global_functions, sizeof(__pyx_k_convert_all_global_functions), 0, 1, 0, 1},
  {&__pyx_n_u_converted_functions, __pyx_k_converted_functions, sizeof(__pyx_k_converted_functions), 0, 1, 0, 1},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
  {&__pyx_n_s_ctx, __pyx_k_ctx, sizeof(__pyx_k_ctx), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_u_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 1, 0, 1},
  {&__pyx_kp_u_d_2, __pyx_k_d_2, sizeof(__pyx_k_d_2), 0, 1, 0, 0},
  {&__pyx_n_s_dec, __pyx_k_dec, sizeof(__pyx_k_dec), 0, 0, 1, 1},
  {&__pyx_n_s_dec_recursion_depth, __pyx_k_dec_recursion_depth, sizeof(__pyx_k_dec_recursion_depth), 0, 0, 1, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_s_default_format, __pyx_k_default_format, sizeof(__pyx_k_default_format), 0, 0, 1, 1},
  {&__pyx_n_s_defaultexpr, __pyx_k_defaultexpr, sizeof(__pyx_k_defaultexpr), 0, 0, 1, 1},
  {&__pyx_n_s_defined_symbols, __pyx_k_defined_symbols, sizeof(__pyx_k_defined_symbols), 0, 0, 1, 1},
  {&__pyx_n_s_definition, __pyx_k_definition, sizeof(__pyx_k_definition), 0, 0, 1, 1},
  {&__pyx_n_s_definitions, __pyx_k_definitions, sizeof(__pyx_k_definitions), 0, 0, 1, 1},
  {&__pyx_n_s_denominator, __pyx_k_denominator, sizeof(__pyx_k_denominator), 0, 0, 1, 1},
  {&__pyx_n_s_deps, __pyx_k_deps, sizeof(__pyx_k_deps), 0, 0, 1, 1},
  {&__pyx_n_s_descend, __pyx_k_descend, sizeof(__pyx_k_descend), 0, 0, 1, 1},
  {&__pyx_n_s_digits, __pyx_k_digits, sizeof(__pyx_k_digits), 0, 0, 1, 1},
  {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 0, 0, 1, 1},
  {&__pyx_n_s_direction, __pyx_k_direction, sizeof(__pyx_k_direction), 0, 0, 1, 1},
  {&__pyx_n_s_dirty_leaves, __pyx_k_dirty_leaves, sizeof(__pyx_k_dirty_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_do_copy, __pyx_k_do_copy, sizeof(__pyx_k_do_copy), 0, 0, 1, 1},
  {&__pyx_n_s_do_flatten, __pyx_k_do_flatten, sizeof(__pyx_k_do_flatten), 0, 0, 1, 1},
  {&__pyx_n_s_do_format, __pyx_k_do_format, sizeof(__pyx_k_do_format), 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_u_down, __pyx_k_down, sizeof(__pyx_k_down), 0, 1, 0, 1},
  {&__pyx_n_s_dps, __pyx_k_dps, sizeof(__pyx_k_dps), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_encode_mathml, __pyx_k_encode_mathml, sizeof(__pyx_k_encode_mathml), 0, 0, 1, 1},
  {&__pyx_n_s_encode_tex, __pyx_k_encode_tex, sizeof(__pyx_k_encode_tex), 0, 0, 1, 1},
  {&__pyx_n_s_encode_tex_locals_replace, __pyx_k_encode_tex_locals_replace, sizeof(__pyx_k_encode_tex_locals_replace), 0, 0, 1, 1},
  {&__pyx_n_s_encoded_text, __pyx_k_encoded_text, sizeof(__pyx_k_encoded_text), 0, 0, 1, 1},
  {&__pyx_n_s_endswith, __pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 0, 1, 1},
  {&__pyx_n_s_ensure_context, __pyx_k_ensure_context, sizeof(__pyx_k_ensure_context), 0, 0, 1, 1},
  {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
  {&__pyx_n_s_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_eq, __pyx_k_eq, sizeof(__pyx_k_eq), 0, 0, 1, 1},
  {&__pyx_n_s_equal2, __pyx_k_equal2, sizeof(__pyx_k_equal2), 0, 0, 1, 1},
  {&__pyx_n_s_equal_heads, __pyx_k_equal_heads, sizeof(__pyx_k_equal_heads), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_escape, __pyx_k_escape, sizeof(__pyx_k_escape), 0, 0, 1, 1},
  {&__pyx_n_s_eval_range, __pyx_k_eval_range, sizeof(__pyx_k_eval_range), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate, __pyx_k_evaluate, sizeof(__pyx_k_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate_leaves, __pyx_k_evaluate_leaves, sizeof(__pyx_k_evaluate_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate_next, __pyx_k_evaluate_next, sizeof(__pyx_k_evaluate_next), 0, 0, 1, 1},
  {&__pyx_n_s_evaluation, __pyx_k_evaluation, sizeof(__pyx_k_evaluation), 0, 0, 1, 1},
  {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
  {&__pyx_n_s_exp, __pyx_k_exp, sizeof(__pyx_k_exp), 0, 0, 1, 1},
  {&__pyx_kp_u_expected_Expression_Structure_tu, __pyx_k_expected_Expression_Structure_tu, sizeof(__pyx_k_expected_Expression_Structure_tu), 0, 1, 0, 0},
  {&__pyx_n_s_expr, __pyx_k_expr, sizeof(__pyx_k_expr), 0, 0, 1, 1},
  {&__pyx_n_s_expressions, __pyx_k_expressions, sizeof(__pyx_k_expressions), 0, 0, 1, 1},
  {&__pyx_n_s_exps, __pyx_k_exps, sizeof(__pyx_k_exps), 0, 0, 1, 1},
  {&__pyx_n_s_exps_dict, __pyx_k_exps_dict, sizeof(__pyx_k_exps_dict), 0, 0, 1, 1},
  {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
  {&__pyx_n_s_extra_operators, __pyx_k_extra_operators, sizeof(__pyx_k_extra_operators), 0, 0, 1, 1},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_n_u_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 1, 0, 1},
  {&__pyx_n_s_filter, __pyx_k_filter, sizeof(__pyx_k_filter), 0, 0, 1, 1},
  {&__pyx_n_s_filter_leaves, __pyx_k_filter_leaves, sizeof(__pyx_k_filter_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_findall, __pyx_k_findall, sizeof(__pyx_k_findall), 0, 0, 1, 1},
  {&__pyx_n_s_flatten, __pyx_k_flatten, sizeof(__pyx_k_flatten), 0, 0, 1, 1},
  {&__pyx_n_s_flatten_callback, __pyx_k_flatten_callback, sizeof(__pyx_k_flatten_callback), 0, 0, 1, 1},
  {&__pyx_n_s_flatten_pattern_sequence, __pyx_k_flatten_pattern_sequence, sizeof(__pyx_k_flatten_pattern_sequence), 0, 0, 1, 1},
  {&__pyx_n_s_flatten_sequence, __pyx_k_flatten_sequence, sizeof(__pyx_k_flatten_sequence), 0, 0, 1, 1},
  {&__pyx_n_s_flatten_sequence_2, __pyx_k_flatten_sequence_2, sizeof(__pyx_k_flatten_sequence_2), 0, 0, 1, 1},
  {&__pyx_n_s_flattened, __pyx_k_flattened, sizeof(__pyx_k_flattened), 0, 0, 1, 1},
  {&__pyx_n_u_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 1, 0, 1},
  {&__pyx_n_s_floordiv, __pyx_k_floordiv, sizeof(__pyx_k_floordiv), 0, 0, 1, 1},
  {&__pyx_n_s_form, __pyx_k_form, sizeof(__pyx_k_form), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_format_cache, __pyx_k_format_cache, sizeof(__pyx_k_format_cache), 0, 0, 1, 1},
  {&__pyx_n_s_format_expr, __pyx_k_format_expr, sizeof(__pyx_k_format_expr), 0, 0, 1, 1},
  {&__pyx_n_s_formats, __pyx_k_formats, sizeof(__pyx_k_formats), 0, 0, 1, 1},
  {&__pyx_n_s_formatted, __pyx_k_formatted, sizeof(__pyx_k_formatted), 0, 0, 1, 1},
  {&__pyx_kp_u_frac, __pyx_k_frac, sizeof(__pyx_k_frac), 0, 1, 0, 0},
  {&__pyx_n_s_from_mpmath, __pyx_k_from_mpmath, sizeof(__pyx_k_from_mpmath), 0, 0, 1, 1},
  {&__pyx_n_s_from_python, __pyx_k_from_python, sizeof(__pyx_k_from_python), 0, 0, 1, 1},
  {&__pyx_n_s_full_atom_names, __pyx_k_full_atom_names, sizeof(__pyx_k_full_atom_names), 0, 0, 1, 1},
  {&__pyx_n_s_fully, __pyx_k_fully, sizeof(__pyx_k_fully), 0, 0, 1, 1},
  {&__pyx_n_s_fully_qualified_symbol_name, __pyx_k_fully_qualified_symbol_name, sizeof(__pyx_k_fully_qualified_symbol_name), 0, 0, 1, 1},
  {&__pyx_n_s_func, __pyx_k_func, sizeof(__pyx_k_func), 0, 0, 1, 1},
  {&__pyx_n_s_func_params, __pyx_k_func_params, sizeof(__pyx_k_func_params), 0, 0, 1, 1},
  {&__pyx_n_s_functions, __pyx_k_functions, sizeof(__pyx_k_functions), 0, 0, 1, 1},
  {&__pyx_n_s_functools, __pyx_k_functools, sizeof(__pyx_k_functools), 0, 0, 1, 1},
  {&__pyx_n_s_ge, __pyx_k_ge, sizeof(__pyx_k_ge), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_get_atom_name, __pyx_k_get_atom_name, sizeof(__pyx_k_get_atom_name), 0, 0, 1, 1},
  {&__pyx_n_s_get_atoms, __pyx_k_get_atoms, sizeof(__pyx_k_get_atoms), 0, 0, 1, 1},
  {&__pyx_n_s_get_attributes, __pyx_k_get_attributes, sizeof(__pyx_k_get_attributes), 0, 0, 1, 1},
  {&__pyx_n_s_get_config_value, __pyx_k_get_config_value, sizeof(__pyx_k_get_config_value), 0, 0, 1, 1},
  {&__pyx_n_s_get_default_value, __pyx_k_get_default_value, sizeof(__pyx_k_get_default_value), 0, 0, 1, 1},
  {&__pyx_n_s_get_definition, __pyx_k_get_definition, sizeof(__pyx_k_get_definition), 0, 0, 1, 1},
  {&__pyx_n_s_get_downvalues, __pyx_k_get_downvalues, sizeof(__pyx_k_get_downvalues), 0, 0, 1, 1},
  {&__pyx_n_s_get_float_value, __pyx_k_get_float_value, sizeof(__pyx_k_get_float_value), 0, 0, 1, 1},
  {&__pyx_n_s_get_formats, __pyx_k_get_formats, sizeof(__pyx_k_get_formats), 0, 0, 1, 1},
  {&__pyx_n_s_get_head, __pyx_k_get_head, sizeof(__pyx_k_get_head), 0, 0, 1, 1},
  {&__pyx_n_s_get_head_name, __pyx_k_get_head_name, sizeof(__pyx_k_get_head_name), 0, 0, 1, 1},
  {&__pyx_n_s_get_int_value, __pyx_k_get_int_value, sizeof(__pyx_k_get_int_value), 0, 0, 1, 1},
  {&__pyx_n_s_get_leaves, __pyx_k_get_leaves, sizeof(__pyx_k_get_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_get_lookup_name, __pyx_k_get_lookup_name, sizeof(__pyx_k_get_lookup_name), 0, 0, 1, 1},
  {&__pyx_n_s_get_mutable_leaves, __pyx_k_get_mutable_leaves, sizeof(__pyx_k_get_mutable_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_get_name, __pyx_k_get_name, sizeof(__pyx_k_get_name), 0, 0, 1, 1},
  {&__pyx_n_s_get_operator_display, __pyx_k_get_operator_display, sizeof(__pyx_k_get_operator_display), 0, 0, 1, 1},
  {&__pyx_n_s_get_option_values, __pyx_k_get_option_values, sizeof(__pyx_k_get_option_values), 0, 0, 1, 1},
  {&__pyx_n_s_get_options, __pyx_k_get_options, sizeof(__pyx_k_get_options), 0, 0, 1, 1},
  {&__pyx_n_s_get_ownvalues, __pyx_k_get_ownvalues, sizeof(__pyx_k_get_ownvalues), 0, 0, 1, 1},
  {&__pyx_n_s_get_precision, __pyx_k_get_precision, sizeof(__pyx_k_get_precision), 0, 0, 1, 1},
  {&__pyx_n_s_get_rules_list, __pyx_k_get_rules_list, sizeof(__pyx_k_get_rules_list), 0, 0, 1, 1},
  {&__pyx_n_s_get_scoping_vars, __pyx_k_get_scoping_vars, sizeof(__pyx_k_get_scoping_vars), 0, 0, 1, 1},
  {&__pyx_n_s_get_sequence, __pyx_k_get_sequence, sizeof(__pyx_k_get_sequence), 0, 0, 1, 1},
  {&__pyx_n_s_get_sort_key, __pyx_k_get_sort_key, sizeof(__pyx_k_get_sort_key), 0, 0, 1, 1},
  {&__pyx_n_u_get_sort_key, __pyx_k_get_sort_key, sizeof(__pyx_k_get_sort_key), 0, 1, 0, 1},
  {&__pyx_n_s_get_string_value, __pyx_k_get_string_value, sizeof(__pyx_k_get_string_value), 0, 0, 1, 1},
  {&__pyx_n_s_get_subvalues, __pyx_k_get_subvalues, sizeof(__pyx_k_get_subvalues), 0, 0, 1, 1},
  {&__pyx_n_s_get_type, __pyx_k_get_type, sizeof(__pyx_k_get_type), 0, 0, 1, 1},
  {&__pyx_n_s_get_upvalues, __pyx_k_get_upvalues, sizeof(__pyx_k_get_upvalues), 0, 0, 1, 1},
  {&__pyx_n_s_get_value, __pyx_k_get_value, sizeof(__pyx_k_get_value), 0, 0, 1, 1},
  {&__pyx_n_s_get_values_list, __pyx_k_get_values_list, sizeof(__pyx_k_get_values_list), 0, 0, 1, 1},
  {&__pyx_n_s_getnewargs, __pyx_k_getnewargs, sizeof(__pyx_k_getnewargs), 0, 0, 1, 1},
  {&__pyx_n_s_group, __pyx_k_group, sizeof(__pyx_k_group), 0, 0, 1, 1},
  {&__pyx_kp_u_gt, __pyx_k_gt, sizeof(__pyx_k_gt), 0, 1, 0, 0},
  {&__pyx_n_s_gt_2, __pyx_k_gt_2, sizeof(__pyx_k_gt_2), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_n_s_has_changed, __pyx_k_has_changed, sizeof(__pyx_k_has_changed), 0, 0, 1, 1},
  {&__pyx_n_s_has_form, __pyx_k_has_form, sizeof(__pyx_k_has_form), 0, 0, 1, 1},
  {&__pyx_n_s_has_symbol, __pyx_k_has_symbol, sizeof(__pyx_k_has_symbol), 0, 0, 1, 1},
  {&__pyx_n_s_hash, __pyx_k_hash, sizeof(__pyx_k_hash), 0, 0, 1, 1},
  {&__pyx_n_s_head, __pyx_k_head, sizeof(__pyx_k_head), 0, 0, 1, 1},
  {&__pyx_n_s_head_2, __pyx_k_head_2, sizeof(__pyx_k_head_2), 0, 0, 1, 1},
  {&__pyx_n_s_head_name, __pyx_k_head_name, sizeof(__pyx_k_head_name), 0, 0, 1, 1},
  {&__pyx_n_s_heads, __pyx_k_heads, sizeof(__pyx_k_heads), 0, 0, 1, 1},
  {&__pyx_n_u_heads, __pyx_k_heads, sizeof(__pyx_k_heads), 0, 1, 0, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_s_imag, __pyx_k_imag, sizeof(__pyx_k_imag), 0, 0, 1, 1},
  {&__pyx_n_s_imag_prec, __pyx_k_imag_prec, sizeof(__pyx_k_imag_prec), 0, 0, 1, 1},
  {&__pyx_n_s_imag_zero, __pyx_k_imag_zero, sizeof(__pyx_k_imag_zero), 0, 0, 1, 1},
  {&__pyx_n_u_image_size_multipliers, __pyx_k_image_size_multipliers, sizeof(__pyx_k_image_size_multipliers), 0, 1, 0, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_in_function, __pyx_k_in_function, sizeof(__pyx_k_in_function), 0, 0, 1, 1},
  {&__pyx_n_s_in_scoping, __pyx_k_in_scoping, sizeof(__pyx_k_in_scoping), 0, 0, 1, 1},
  {&__pyx_n_s_in_text, __pyx_k_in_text, sizeof(__pyx_k_in_text), 0, 0, 1, 1},
  {&__pyx_n_s_inc_recursion_depth, __pyx_k_inc_recursion_depth, sizeof(__pyx_k_inc_recursion_depth), 0, 0, 1, 1},
  {&__pyx_n_s_include_form, __pyx_k_include_form, sizeof(__pyx_k_include_form), 0, 0, 1, 1},
  {&__pyx_n_s_include_heads, __pyx_k_include_heads, sizeof(__pyx_k_include_heads), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1},
  {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1},
  {&__pyx_n_u_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 1, 0, 1},
  {&__pyx_kp_u_infty, __pyx_k_infty, sizeof(__pyx_k_infty), 0, 1, 0, 0},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_inner, __pyx_k_inner, sizeof(__pyx_k_inner), 0, 0, 1, 1},
  {&__pyx_n_s_innerleaf, __pyx_k_innerleaf, sizeof(__pyx_k_innerleaf), 0, 0, 1, 1},
  {&__pyx_n_u_inside_list, __pyx_k_inside_list, sizeof(__pyx_k_inside_list), 0, 1, 0, 1},
  {&__pyx_n_s_inside_row, __pyx_k_inside_row, sizeof(__pyx_k_inside_row), 0, 0, 1, 1},
  {&__pyx_n_u_inside_row, __pyx_k_inside_row, sizeof(__pyx_k_inside_row), 0, 1, 0, 1},
  {&__pyx_kp_u_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 1, 0, 0},
  {&__pyx_n_u_int_2, __pyx_k_int_2, sizeof(__pyx_k_int_2), 0, 1, 0, 1},
  {&__pyx_n_s_intersection, __pyx_k_intersection, sizeof(__pyx_k_intersection), 0, 0, 1, 1},
  {&__pyx_n_s_is_approx_zero, __pyx_k_is_approx_zero, sizeof(__pyx_k_is_approx_zero), 0, 0, 1, 1},
  {&__pyx_n_u_is_approx_zero, __pyx_k_is_approx_zero, sizeof(__pyx_k_is_approx_zero), 0, 1, 0, 1},
  {&__pyx_n_s_is_atom, __pyx_k_is_atom, sizeof(__pyx_k_is_atom), 0, 0, 1, 1},
  {&__pyx_n_s_is_constant, __pyx_k_is_constant, sizeof(__pyx_k_is_constant), 0, 0, 1, 1},
  {&__pyx_n_s_is_free, __pyx_k_is_free, sizeof(__pyx_k_is_free), 0, 0, 1, 1},
  {&__pyx_n_s_is_inexact, __pyx_k_is_inexact, sizeof(__pyx_k_is_inexact), 0, 0, 1, 1},
  {&__pyx_n_s_is_list_interior, __pyx_k_is_list_interior, sizeof(__pyx_k_is_list_interior), 0, 0, 1, 1},
  {&__pyx_n_s_is_list_row, __pyx_k_is_list_row, sizeof(__pyx_k_is_list_row), 0, 0, 1, 1},
  {&__pyx_n_s_is_machine_precision, __pyx_k_is_machine_precision, sizeof(__pyx_k_is_machine_precision), 0, 0, 1, 1},
  {&__pyx_n_s_is_neutral_head, __pyx_k_is_neutral_head, sizeof(__pyx_k_is_neutral_head), 0, 0, 1, 1},
  {&__pyx_n_s_is_neutral_symbol, __pyx_k_is_neutral_symbol, sizeof(__pyx_k_is_neutral_symbol), 0, 0, 1, 1},
  {&__pyx_n_s_is_neutral_symbol_locals_genexp, __pyx_k_is_neutral_symbol_locals_genexp, sizeof(__pyx_k_is_neutral_symbol_locals_genexp), 0, 0, 1, 1},
  {&__pyx_n_s_is_numeric, __pyx_k_is_numeric, sizeof(__pyx_k_is_numeric), 0, 0, 1, 1},
  {&__pyx_n_s_is_style, __pyx_k_is_style, sizeof(__pyx_k_is_style), 0, 0, 1, 1},
  {&__pyx_n_s_is_symbol, __pyx_k_is_symbol, sizeof(__pyx_k_is_symbol), 0, 0, 1, 1},
  {&__pyx_n_s_is_symbol_name, __pyx_k_is_symbol_name, sizeof(__pyx_k_is_symbol_name), 0, 0, 1, 1},
  {&__pyx_n_s_is_true, __pyx_k_is_true, sizeof(__pyx_k_is_true), 0, 0, 1, 1},
  {&__pyx_n_s_is_zero, __pyx_k_is_zero, sizeof(__pyx_k_is_zero), 0, 0, 1, 1},
  {&__pyx_n_s_isinf, __pyx_k_isinf, sizeof(__pyx_k_isinf), 0, 0, 1, 1},
  {&__pyx_n_s_isnan, __pyx_k_isnan, sizeof(__pyx_k_isnan), 0, 0, 1, 1},
  {&__pyx_n_s_item, __pyx_k_item, sizeof(__pyx_k_item), 0, 0, 1, 1},
  {&__pyx_n_s_item1, __pyx_k_item1, sizeof(__pyx_k_item1), 0, 0, 1, 1},
  {&__pyx_n_s_item2, __pyx_k_item2, sizeof(__pyx_k_item2), 0, 0, 1, 1},
  {&__pyx_n_s_item_is_free, __pyx_k_item_is_free, sizeof(__pyx_k_item_is_free), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_iteration, __pyx_k_iteration, sizeof(__pyx_k_iteration), 0, 0, 1, 1},
  {&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1},
  {&__pyx_n_u_itlim, __pyx_k_itlim, sizeof(__pyx_k_itlim), 0, 1, 0, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_l1, __pyx_k_l1, sizeof(__pyx_k_l1), 0, 0, 1, 1},
  {&__pyx_n_s_l2, __pyx_k_l2, sizeof(__pyx_k_l2), 0, 0, 1, 1},
  {&__pyx_n_s_last_evaluated, __pyx_k_last_evaluated, sizeof(__pyx_k_last_evaluated), 0, 0, 1, 1},
  {&__pyx_n_s_le, __pyx_k_le, sizeof(__pyx_k_le), 0, 0, 1, 1},
  {&__pyx_n_s_leaf, __pyx_k_leaf, sizeof(__pyx_k_leaf), 0, 0, 1, 1},
  {&__pyx_n_s_leaf_counts, __pyx_k_leaf_counts, sizeof(__pyx_k_leaf_counts), 0, 0, 1, 1},
  {&__pyx_n_s_leaf_prec, __pyx_k_leaf_prec, sizeof(__pyx_k_leaf_prec), 0, 0, 1, 1},
  {&__pyx_n_s_leaf_symbols, __pyx_k_leaf_symbols, sizeof(__pyx_k_leaf_symbols), 0, 0, 1, 1},
  {&__pyx_n_s_leaves, __pyx_k_leaves, sizeof(__pyx_k_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_leaves_2, __pyx_k_leaves_2, sizeof(__pyx_k_leaves_2), 0, 0, 1, 1},
  {&__pyx_kp_u_left_left, __pyx_k_left_left, sizeof(__pyx_k_left_left), 0, 1, 0, 0},
  {&__pyx_kp_u_left_s, __pyx_k_left_s, sizeof(__pyx_k_left_s), 0, 1, 0, 0},
  {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1},
  {&__pyx_n_u_levelspec, __pyx_k_levelspec, sizeof(__pyx_k_levelspec), 0, 1, 0, 1},
  {&__pyx_n_s_limit, __pyx_k_limit, sizeof(__pyx_k_limit), 0, 0, 1, 1},
  {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1},
  {&__pyx_n_s_list, __pyx_k_list, sizeof(__pyx_k_list), 0, 0, 1, 1},
  {&__pyx_n_s_list_expr, __pyx_k_list_expr, sizeof(__pyx_k_list_expr), 0, 0, 1, 1},
  {&__pyx_n_s_lookup_name, __pyx_k_lookup_name, sizeof(__pyx_k_lookup_name), 0, 0, 1, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_s_lru_cache, __pyx_k_lru_cache, sizeof(__pyx_k_lru_cache), 0, 0, 1, 1},
  {&__pyx_n_s_lstrip, __pyx_k_lstrip, sizeof(__pyx_k_lstrip), 0, 0, 1, 1},
  {&__pyx_kp_u_lt, __pyx_k_lt, sizeof(__pyx_k_lt), 0, 1, 0, 0},
  {&__pyx_n_s_lt_2, __pyx_k_lt_2, sizeof(__pyx_k_lt_2), 0, 0, 1, 1},
  {&__pyx_n_s_m1, __pyx_k_m1, sizeof(__pyx_k_m1), 0, 0, 1, 1},
  {&__pyx_n_s_m2, __pyx_k_m2, sizeof(__pyx_k_m2), 0, 0, 1, 1},
  {&__pyx_n_s_machine_precision, __pyx_k_machine_precision, sizeof(__pyx_k_machine_precision), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_make_boxes, __pyx_k_make_boxes, sizeof(__pyx_k_make_boxes), 0, 0, 1, 1},
  {&__pyx_n_s_man, __pyx_k_man, sizeof(__pyx_k_man), 0, 0, 1, 1},
  {&__pyx_n_s_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 0, 1, 1},
  {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
  {&__pyx_kp_u_math_inf, __pyx_k_math_inf, sizeof(__pyx_k_math_inf), 0, 1, 0, 0},
  {&__pyx_n_s_mathics_builtin, __pyx_k_mathics_builtin, sizeof(__pyx_k_mathics_builtin), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_builtin_base, __pyx_k_mathics_builtin_base, sizeof(__pyx_k_mathics_builtin_base), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_builtin_inout, __pyx_k_mathics_builtin_inout, sizeof(__pyx_k_mathics_builtin_inout), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_builtin_patterns, __pyx_k_mathics_builtin_patterns, sizeof(__pyx_k_mathics_builtin_patterns), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_builtin_scoping, __pyx_k_mathics_builtin_scoping, sizeof(__pyx_k_mathics_builtin_scoping), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_core_convert, __pyx_k_mathics_core_convert, sizeof(__pyx_k_mathics_core_convert), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_core_evaluation, __pyx_k_mathics_core_evaluation, sizeof(__pyx_k_mathics_core_evaluation), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_core_expression, __pyx_k_mathics_core_expression, sizeof(__pyx_k_mathics_core_expression), 0, 0, 1, 1},
  {&__pyx_kp_s_mathics_core_expression_py, __pyx_k_mathics_core_expression_py, sizeof(__pyx_k_mathics_core_expression_py), 0, 0, 1, 0},
  {&__pyx_n_s_mathics_core_numbers, __pyx_k_mathics_core_numbers, sizeof(__pyx_k_mathics_core_numbers), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_core_parser, __pyx_k_mathics_core_parser, sizeof(__pyx_k_mathics_core_parser), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_core_rules, __pyx_k_mathics_core_rules, sizeof(__pyx_k_mathics_core_rules), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_to_python, __pyx_k_mathics_to_python, sizeof(__pyx_k_mathics_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_to_sympy, __pyx_k_mathics_to_sympy, sizeof(__pyx_k_mathics_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_maxsize, __pyx_k_maxsize, sizeof(__pyx_k_maxsize), 0, 0, 1, 1},
  {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
  {&__pyx_n_s_message_args, __pyx_k_message_args, sizeof(__pyx_k_message_args), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_kp_u_mfrac, __pyx_k_mfrac, sizeof(__pyx_k_mfrac), 0, 1, 0, 0},
  {&__pyx_kp_u_mfrac_2, __pyx_k_mfrac_2, sizeof(__pyx_k_mfrac_2), 0, 1, 0, 0},
  {&__pyx_kp_u_mi_s_mi, __pyx_k_mi_s_mi, sizeof(__pyx_k_mi_s_mi), 0, 1, 0, 0},
  {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
  {&__pyx_n_s_min_key, __pyx_k_min_key, sizeof(__pyx_k_min_key), 0, 0, 1, 1},
  {&__pyx_n_s_min_prec, __pyx_k_min_prec, sizeof(__pyx_k_min_prec), 0, 0, 1, 1},
  {&__pyx_n_s_minus, __pyx_k_minus, sizeof(__pyx_k_minus), 0, 0, 1, 1},
  {&__pyx_kp_u_mn_s_mn, __pyx_k_mn_s_mn, sizeof(__pyx_k_mn_s_mn), 0, 1, 0, 0},
  {&__pyx_kp_u_mo_form_prefix_lspace_0_2em_rsp, __pyx_k_mo_form_prefix_lspace_0_2em_rsp, sizeof(__pyx_k_mo_form_prefix_lspace_0_2em_rsp), 0, 1, 0, 0},
  {&__pyx_kp_u_mo_form_prefix_lspace_0_rspace, __pyx_k_mo_form_prefix_lspace_0_rspace, sizeof(__pyx_k_mo_form_prefix_lspace_0_rspace), 0, 1, 0, 0},
  {&__pyx_kp_u_mo_s_mo, __pyx_k_mo_s_mo, sizeof(__pyx_k_mo_s_mo), 0, 1, 0, 0},
  {&__pyx_n_s_modname, __pyx_k_modname, sizeof(__pyx_k_modname), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_mpc, __pyx_k_mpc, sizeof(__pyx_k_mpc), 0, 0, 1, 1},
  {&__pyx_n_s_mpf, __pyx_k_mpf, sizeof(__pyx_k_mpf), 0, 0, 1, 1},
  {&__pyx_n_s_mpmath, __pyx_k_mpmath, sizeof(__pyx_k_mpmath), 0, 0, 1, 1},
  {&__pyx_kp_u_mrow_s_mrow, __pyx_k_mrow_s_mrow, sizeof(__pyx_k_mrow_s_mrow), 0, 1, 0, 0},
  {&__pyx_kp_u_ms_s_ms, __pyx_k_ms_s_ms, sizeof(__pyx_k_ms_s_ms), 0, 1, 0, 0},
  {&__pyx_kp_u_mspace_linebreak_newline, __pyx_k_mspace_linebreak_newline, sizeof(__pyx_k_mspace_linebreak_newline), 0, 1, 0, 0},
  {&__pyx_kp_u_msqrt_s_msqrt, __pyx_k_msqrt_s_msqrt, sizeof(__pyx_k_msqrt_s_msqrt), 0, 1, 0, 0},
  {&__pyx_kp_u_msub, __pyx_k_msub, sizeof(__pyx_k_msub), 0, 1, 0, 0},
  {&__pyx_kp_u_msub_2, __pyx_k_msub_2, sizeof(__pyx_k_msub_2), 0, 1, 0, 0},
  {&__pyx_kp_u_msubsup, __pyx_k_msubsup, sizeof(__pyx_k_msubsup), 0, 1, 0, 0},
  {&__pyx_kp_u_msubsup_2, __pyx_k_msubsup_2, sizeof(__pyx_k_msubsup_2), 0, 1, 0, 0},
  {&__pyx_kp_u_msup, __pyx_k_msup, sizeof(__pyx_k_msup), 0, 1, 0, 0},
  {&__pyx_kp_u_msup_2, __pyx_k_msup_2, sizeof(__pyx_k_msup_2), 0, 1, 0, 0},
  {&__pyx_kp_u_mtext_s_mtext, __pyx_k_mtext_s_mtext, sizeof(__pyx_k_mtext_s_mtext), 0, 1, 0, 0},
  {&__pyx_n_s_mul, __pyx_k_mul, sizeof(__pyx_k_mul), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_n_evaluation, __pyx_k_n_evaluation, sizeof(__pyx_k_n_evaluation), 0, 0, 1, 1},
  {&__pyx_n_u_n_evaluation, __pyx_k_n_evaluation, sizeof(__pyx_k_n_evaluation), 0, 1, 0, 1},
  {&__pyx_n_s_n_expr, __pyx_k_n_expr, sizeof(__pyx_k_n_expr), 0, 0, 1, 1},
  {&__pyx_n_s_n_result, __pyx_k_n_result, sizeof(__pyx_k_n_result), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_names, __pyx_k_names, sizeof(__pyx_k_names), 0, 0, 1, 1},
  {&__pyx_kp_u_nbsp, __pyx_k_nbsp, sizeof(__pyx_k_nbsp), 0, 1, 0, 0},
  {&__pyx_n_s_ne, __pyx_k_ne, sizeof(__pyx_k_ne), 0, 0, 1, 1},
  {&__pyx_n_s_neg, __pyx_k_neg, sizeof(__pyx_k_neg), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_new_2, __pyx_k_new_2, sizeof(__pyx_k_new_2), 0, 0, 1, 1},
  {&__pyx_n_s_new_applied, __pyx_k_new_applied, sizeof(__pyx_k_new_applied), 0, 0, 1, 1},
  {&__pyx_n_s_new_leaf, __pyx_k_new_leaf, sizeof(__pyx_k_new_leaf), 0, 0, 1, 1},
  {&__pyx_n_s_new_leaves, __pyx_k_new_leaves, sizeof(__pyx_k_new_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_new_sequences, __pyx_k_new_sequences, sizeof(__pyx_k_new_sequences), 0, 0, 1, 1},
  {&__pyx_kp_u_newline, __pyx_k_newline, sizeof(__pyx_k_newline), 0, 1, 0, 0},
  {&__pyx_n_s_no_symbol, __pyx_k_no_symbol, sizeof(__pyx_k_no_symbol), 0, 0, 1, 1},
  {&__pyx_n_s_now, __pyx_k_now, sizeof(__pyx_k_now), 0, 0, 1, 1},
  {&__pyx_n_s_number_form, __pyx_k_number_form, sizeof(__pyx_k_number_form), 0, 0, 1, 1},
  {&__pyx_n_s_number_form_options, __pyx_k_number_form_options, sizeof(__pyx_k_number_form_options), 0, 0, 1, 1},
  {&__pyx_n_s_number_type, __pyx_k_number_type, sizeof(__pyx_k_number_type), 0, 0, 1, 1},
  {&__pyx_n_s_numerator, __pyx_k_numerator, sizeof(__pyx_k_numerator), 0, 0, 1, 1},
  {&__pyx_n_s_numerify, __pyx_k_numerify, sizeof(__pyx_k_numerify), 0, 0, 1, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_n_s_old, __pyx_k_old, sizeof(__pyx_k_old), 0, 0, 1, 1},
  {&__pyx_n_s_old_options, __pyx_k_old_options, sizeof(__pyx_k_old_options), 0, 0, 1, 1},
  {&__pyx_n_s_only_if_exists, __pyx_k_only_if_exists, sizeof(__pyx_k_only_if_exists), 0, 0, 1, 1},
  {&__pyx_n_s_only_subsup, __pyx_k_only_subsup, sizeof(__pyx_k_only_subsup), 0, 0, 1, 1},
  {&__pyx_n_s_operator, __pyx_k_operator, sizeof(__pyx_k_operator), 0, 0, 1, 1},
  {&__pyx_n_s_operators, __pyx_k_operators, sizeof(__pyx_k_operators), 0, 0, 1, 1},
  {&__pyx_n_s_optimize, __pyx_k_optimize, sizeof(__pyx_k_optimize), 0, 0, 1, 1},
  {&__pyx_n_s_option, __pyx_k_option, sizeof(__pyx_k_option), 0, 0, 1, 1},
  {&__pyx_n_s_option_values, __pyx_k_option_values, sizeof(__pyx_k_option_values), 0, 0, 1, 1},
  {&__pyx_n_s_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 0, 1, 1},
  {&__pyx_n_u_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 1, 0, 1},
  {&__pyx_n_s_original, __pyx_k_original, sizeof(__pyx_k_original), 0, 0, 1, 1},
  {&__pyx_n_s_origins, __pyx_k_origins, sizeof(__pyx_k_origins), 0, 0, 1, 1},
  {&__pyx_n_s_other, __pyx_k_other, sizeof(__pyx_k_other), 0, 0, 1, 1},
  {&__pyx_n_s_other_exp, __pyx_k_other_exp, sizeof(__pyx_k_other_exp), 0, 0, 1, 1},
  {&__pyx_n_s_other_exps, __pyx_k_other_exps, sizeof(__pyx_k_other_exps), 0, 0, 1, 1},
  {&__pyx_n_s_other_len, __pyx_k_other_len, sizeof(__pyx_k_other_len), 0, 0, 1, 1},
  {&__pyx_n_s_other_var, __pyx_k_other_var, sizeof(__pyx_k_other_var), 0, 0, 1, 1},
  {&__pyx_n_s_outer_precedence, __pyx_k_outer_precedence, sizeof(__pyx_k_outer_precedence), 0, 0, 1, 1},
  {&__pyx_n_s_outtext, __pyx_k_outtext, sizeof(__pyx_k_outtext), 0, 0, 1, 1},
  {&__pyx_n_u_own, __pyx_k_own, sizeof(__pyx_k_own), 0, 1, 0, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
  {&__pyx_n_s_parenthesize_when_equal, __pyx_k_parenthesize_when_equal, sizeof(__pyx_k_parenthesize_when_equal), 0, 0, 1, 1},
  {&__pyx_n_s_parts, __pyx_k_parts, sizeof(__pyx_k_parts), 0, 0, 1, 1},
  {&__pyx_n_s_pattern, __pyx_k_pattern, sizeof(__pyx_k_pattern), 0, 0, 1, 1},
  {&__pyx_n_s_pattern_only, __pyx_k_pattern_only, sizeof(__pyx_k_pattern_only), 0, 0, 1, 1},
  {&__pyx_n_s_pattern_sequence, __pyx_k_pattern_sequence, sizeof(__pyx_k_pattern_sequence), 0, 0, 1, 1},
  {&__pyx_n_s_pattern_sort, __pyx_k_pattern_sort, sizeof(__pyx_k_pattern_sort), 0, 0, 1, 1},
  {&__pyx_n_s_permit_complex, __pyx_k_permit_complex, sizeof(__pyx_k_permit_complex), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_s_pos_2, __pyx_k_pos_2, sizeof(__pyx_k_pos_2), 0, 0, 1, 1},
  {&__pyx_n_s_pos_len, __pyx_k_pos_len, sizeof(__pyx_k_pos_len), 0, 0, 1, 1},
  {&__pyx_n_s_position, __pyx_k_position, sizeof(__pyx_k_position), 0, 0, 1, 1},
  {&__pyx_n_s_pow, __pyx_k_pow, sizeof(__pyx_k_pow), 0, 0, 1, 1},
  {&__pyx_n_s_prec, __pyx_k_prec, sizeof(__pyx_k_prec), 0, 0, 1, 1},
  {&__pyx_n_s_prec_2, __pyx_k_prec_2, sizeof(__pyx_k_prec_2), 0, 0, 1, 1},
  {&__pyx_n_s_precedence, __pyx_k_precedence, sizeof(__pyx_k_precedence), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_print_parenthesizes, __pyx_k_print_parenthesizes, sizeof(__pyx_k_print_parenthesizes), 0, 0, 1, 1},
  {&__pyx_n_s_process_style_box, __pyx_k_process_style_box, sizeof(__pyx_k_process_style_box), 0, 0, 1, 1},
  {&__pyx_kp_u_prod, __pyx_k_prod, sizeof(__pyx_k_prod), 0, 1, 0, 0},
  {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
  {&__pyx_n_s_py_obj, __pyx_k_py_obj, sizeof(__pyx_k_py_obj), 0, 0, 1, 1},
  {&__pyx_n_s_py_slice, __pyx_k_py_slice, sizeof(__pyx_k_py_slice), 0, 0, 1, 1},
  {&__pyx_n_u_python_form, __pyx_k_python_form, sizeof(__pyx_k_python_form), 0, 1, 0, 1},
  {&__pyx_n_u_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 1, 0, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_kp_u_quot, __pyx_k_quot, sizeof(__pyx_k_quot), 0, 1, 0, 0},
  {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
  {&__pyx_n_s_real, __pyx_k_real, sizeof(__pyx_k_real), 0, 0, 1, 1},
  {&__pyx_n_s_real_prec, __pyx_k_real_prec, sizeof(__pyx_k_real_prec), 0, 0, 1, 1},
  {&__pyx_n_s_real_zero, __pyx_k_real_zero, sizeof(__pyx_k_real_zero), 0, 0, 1, 1},
  {&__pyx_n_s_rebuild_cache, __pyx_k_rebuild_cache, sizeof(__pyx_k_rebuild_cache), 0, 0, 1, 1},
  {&__pyx_n_s_reevaluate, __pyx_k_reevaluate, sizeof(__pyx_k_reevaluate), 0, 0, 1, 1},
  {&__pyx_n_s_rel_eps, __pyx_k_rel_eps, sizeof(__pyx_k_rel_eps), 0, 0, 1, 1},
  {&__pyx_n_s_render, __pyx_k_render, sizeof(__pyx_k_render), 0, 0, 1, 1},
  {&__pyx_n_s_reordered, __pyx_k_reordered, sizeof(__pyx_k_reordered), 0, 0, 1, 1},
  {&__pyx_n_s_repl, __pyx_k_repl, sizeof(__pyx_k_repl), 0, 0, 1, 1},
  {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
  {&__pyx_n_s_replace_slots, __pyx_k_replace_slots, sizeof(__pyx_k_replace_slots), 0, 0, 1, 1},
  {&__pyx_n_s_replace_vars, __pyx_k_replace_vars, sizeof(__pyx_k_replace_vars), 0, 0, 1, 1},
  {&__pyx_n_s_replacement, __pyx_k_replacement, sizeof(__pyx_k_replacement), 0, 0, 1, 1},
  {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1},
  {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1},
  {&__pyx_n_s_rest_range, __pyx_k_rest_range, sizeof(__pyx_k_rest_range), 0, 0, 1, 1},
  {&__pyx_n_s_restructure, __pyx_k_restructure, sizeof(__pyx_k_restructure), 0, 0, 1, 1},
  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_n_s_ret, __pyx_k_ret, sizeof(__pyx_k_ret), 0, 0, 1, 1},
  {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1},
  {&__pyx_n_s_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 0, 1, 1},
  {&__pyx_n_s_rhs, __pyx_k_rhs, sizeof(__pyx_k_rhs), 0, 0, 1, 1},
  {&__pyx_kp_u_right_right, __pyx_k_right_right, sizeof(__pyx_k_right_right), 0, 1, 0, 0},
  {&__pyx_kp_u_right_s, __pyx_k_right_s, sizeof(__pyx_k_right_s), 0, 1, 0, 0},
  {&__pyx_n_s_rindex, __pyx_k_rindex, sizeof(__pyx_k_rindex), 0, 0, 1, 1},
  {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1},
  {&__pyx_n_s_round_to_float, __pyx_k_round_to_float, sizeof(__pyx_k_round_to_float), 0, 0, 1, 1},
  {&__pyx_n_s_rule, __pyx_k_rule, sizeof(__pyx_k_rule), 0, 0, 1, 1},
  {&__pyx_n_s_rules, __pyx_k_rules, sizeof(__pyx_k_rules), 0, 0, 1, 1},
  {&__pyx_n_s_rules_names, __pyx_k_rules_names, sizeof(__pyx_k_rules_names), 0, 0, 1, 1},
  {&__pyx_kp_u_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 1, 0, 0},
  {&__pyx_kp_u_s_2, __pyx_k_s_2, sizeof(__pyx_k_s_2), 0, 1, 0, 0},
  {&__pyx_kp_u_s_3, __pyx_k_s_3, sizeof(__pyx_k_s_3), 0, 1, 0, 0},
  {&__pyx_kp_u_s_4, __pyx_k_s_4, sizeof(__pyx_k_s_4), 0, 1, 0, 0},
  {&__pyx_kp_u_s_5, __pyx_k_s_5, sizeof(__pyx_k_s_5), 0, 1, 0, 0},
  {&__pyx_n_s_s_6, __pyx_k_s_6, sizeof(__pyx_k_s_6), 0, 0, 1, 1},
  {&__pyx_kp_u_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 1, 0, 0},
  {&__pyx_n_s_sameQ, __pyx_k_sameQ, sizeof(__pyx_k_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_scoping_vars, __pyx_k_scoping_vars, sizeof(__pyx_k_scoping_vars), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_self_exp, __pyx_k_self_exp, sizeof(__pyx_k_self_exp), 0, 0, 1, 1},
  {&__pyx_n_s_self_exps, __pyx_k_self_exps, sizeof(__pyx_k_self_exps), 0, 0, 1, 1},
  {&__pyx_n_s_self_len, __pyx_k_self_len, sizeof(__pyx_k_self_len), 0, 0, 1, 1},
  {&__pyx_n_s_self_var, __pyx_k_self_var, sizeof(__pyx_k_self_var), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_seq, __pyx_k_seq, sizeof(__pyx_k_seq), 0, 0, 1, 1},
  {&__pyx_n_s_sequence, __pyx_k_sequence, sizeof(__pyx_k_sequence), 0, 0, 1, 1},
  {&__pyx_n_s_sequences, __pyx_k_sequences, sizeof(__pyx_k_sequences), 0, 0, 1, 1},
  {&__pyx_n_s_sequences_2, __pyx_k_sequences_2, sizeof(__pyx_k_sequences_2), 0, 0, 1, 1},
  {&__pyx_n_s_set_head, __pyx_k_set_head, sizeof(__pyx_k_set_head), 0, 0, 1, 1},
  {&__pyx_n_s_set_leaf, __pyx_k_set_leaf, sizeof(__pyx_k_set_leaf), 0, 0, 1, 1},
  {&__pyx_n_s_set_positions, __pyx_k_set_positions, sizeof(__pyx_k_set_positions), 0, 0, 1, 1},
  {&__pyx_n_s_set_reordered_leaves, __pyx_k_set_reordered_leaves, sizeof(__pyx_k_set_reordered_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_setter, __pyx_k_setter, sizeof(__pyx_k_setter), 0, 0, 1, 1},
  {&__pyx_n_s_shallow_copy, __pyx_k_shallow_copy, sizeof(__pyx_k_shallow_copy), 0, 0, 1, 1},
  {&__pyx_n_s_shorten_name, __pyx_k_shorten_name, sizeof(__pyx_k_shorten_name), 0, 0, 1, 1},
  {&__pyx_n_s_show_string_characters, __pyx_k_show_string_characters, sizeof(__pyx_k_show_string_characters), 0, 0, 1, 1},
  {&__pyx_n_u_show_string_characters, __pyx_k_show_string_characters, sizeof(__pyx_k_show_string_characters), 0, 1, 0, 1},
  {&__pyx_kp_u_sim, __pyx_k_sim, sizeof(__pyx_k_sim), 0, 1, 0, 0},
  {&__pyx_kp_u_sim_2, __pyx_k_sim_2, sizeof(__pyx_k_sim_2), 0, 1, 0, 0},
  {&__pyx_n_s_slice, __pyx_k_slice, sizeof(__pyx_k_slice), 0, 0, 1, 1},
  {&__pyx_n_s_sliced, __pyx_k_sliced, sizeof(__pyx_k_sliced), 0, 0, 1, 1},
  {&__pyx_n_s_slot, __pyx_k_slot, sizeof(__pyx_k_slot), 0, 0, 1, 1},
  {&__pyx_n_u_slot, __pyx_k_slot, sizeof(__pyx_k_slot), 0, 1, 0, 1},
  {&__pyx_n_u_slotn, __pyx_k_slotn, sizeof(__pyx_k_slotn), 0, 1, 0, 1},
  {&__pyx_n_s_slots, __pyx_k_slots, sizeof(__pyx_k_slots), 0, 0, 1, 1},
  {&__pyx_n_s_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_kp_u_sqrt_s, __pyx_k_sqrt_s, sizeof(__pyx_k_sqrt_s), 0, 1, 0, 0},
  {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
  {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  {&__pyx_n_s_stop_on_error, __pyx_k_stop_on_error, sizeof(__pyx_k_stop_on_error), 0, 0, 1, 1},
  {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1},
  {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1},
  {&__pyx_n_s_string_list, __pyx_k_string_list, sizeof(__pyx_k_string_list), 0, 0, 1, 1},
  {&__pyx_n_u_string_quotes, __pyx_k_string_quotes, sizeof(__pyx_k_string_quotes), 0, 1, 0, 1},
  {&__pyx_n_s_strip_context, __pyx_k_strip_context, sizeof(__pyx_k_strip_context), 0, 0, 1, 1},
  {&__pyx_n_s_structure, __pyx_k_structure, sizeof(__pyx_k_structure), 0, 0, 1, 1},
  {&__pyx_n_s_structure_cache, __pyx_k_structure_cache, sizeof(__pyx_k_structure_cache), 0, 0, 1, 1},
  {&__pyx_n_s_sub, __pyx_k_sub, sizeof(__pyx_k_sub), 0, 0, 1, 1},
  {&__pyx_n_u_sub, __pyx_k_sub, sizeof(__pyx_k_sub), 0, 1, 0, 1},
  {&__pyx_n_s_sub_2, __pyx_k_sub_2, sizeof(__pyx_k_sub_2), 0, 0, 1, 1},
  {&__pyx_n_s_sub_applied, __pyx_k_sub_applied, sizeof(__pyx_k_sub_applied), 0, 0, 1, 1},
  {&__pyx_n_s_sub_level, __pyx_k_sub_level, sizeof(__pyx_k_sub_level), 0, 0, 1, 1},
  {&__pyx_kp_u_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 1, 0, 0},
  {&__pyx_n_s_sup_string, __pyx_k_sup_string, sizeof(__pyx_k_sup_string), 0, 0, 1, 1},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_sym, __pyx_k_sym, sizeof(__pyx_k_sym), 0, 0, 1, 1},
  {&__pyx_n_s_sym_args, __pyx_k_sym_args, sizeof(__pyx_k_sym_args), 0, 0, 1, 1},
  {&__pyx_n_s_symbol_name, __pyx_k_symbol_name, sizeof(__pyx_k_symbol_name), 0, 0, 1, 1},
  {&__pyx_n_s_symbolname, __pyx_k_symbolname, sizeof(__pyx_k_symbolname), 0, 0, 1, 1},
  {&__pyx_n_s_symbols, __pyx_k_symbols, sizeof(__pyx_k_symbols), 0, 0, 1, 1},
  {&__pyx_n_s_sympy, __pyx_k_sympy, sizeof(__pyx_k_sympy), 0, 0, 1, 1},
  {&__pyx_kp_u_sympy_2, __pyx_k_sympy_2, sizeof(__pyx_k_sympy_2), 0, 1, 0, 0},
  {&__pyx_n_s_sympy_dummy, __pyx_k_sympy_dummy, sizeof(__pyx_k_sympy_dummy), 0, 0, 1, 1},
  {&__pyx_n_s_sympy_expr, __pyx_k_sympy_expr, sizeof(__pyx_k_sympy_expr), 0, 0, 1, 1},
  {&__pyx_n_s_sympy_name, __pyx_k_sympy_name, sizeof(__pyx_k_sympy_name), 0, 0, 1, 1},
  {&__pyx_n_s_sympy_symbol_prefix, __pyx_k_sympy_symbol_prefix, sizeof(__pyx_k_sympy_symbol_prefix), 0, 0, 1, 1},
  {&__pyx_n_s_system_symbols, __pyx_k_system_symbols, sizeof(__pyx_k_system_symbols), 0, 0, 1, 1},
  {&__pyx_n_s_system_symbols_dict, __pyx_k_system_symbols_dict, sizeof(__pyx_k_system_symbols_dict), 0, 0, 1, 1},
  {&__pyx_n_u_tdlen, __pyx_k_tdlen, sizeof(__pyx_k_tdlen), 0, 1, 0, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_tex, __pyx_k_tex, sizeof(__pyx_k_tex), 0, 0, 1, 1},
  {&__pyx_n_u_tex, __pyx_k_tex, sizeof(__pyx_k_tex), 0, 1, 0, 1},
  {&__pyx_n_s_tex1, __pyx_k_tex1, sizeof(__pyx_k_tex1), 0, 0, 1, 1},
  {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
  {&__pyx_n_u_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 1, 0, 1},
  {&__pyx_kp_u_text_s, __pyx_k_text_s, sizeof(__pyx_k_text_s), 0, 1, 0, 0},
  {&__pyx_kp_u_text_s_2, __pyx_k_text_s_2, sizeof(__pyx_k_text_s_2), 0, 1, 0, 0},
  {&__pyx_n_s_thread, __pyx_k_thread, sizeof(__pyx_k_thread), 0, 0, 1, 1},
  {&__pyx_n_s_threaded, __pyx_k_threaded, sizeof(__pyx_k_threaded), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1},
  {&__pyx_kp_u_times, __pyx_k_times, sizeof(__pyx_k_times), 0, 1, 0, 0},
  {&__pyx_n_s_timestamp_cache, __pyx_k_timestamp_cache, sizeof(__pyx_k_timestamp_cache), 0, 0, 1, 1},
  {&__pyx_n_s_to_mpmath, __pyx_k_to_mpmath, sizeof(__pyx_k_to_mpmath), 0, 0, 1, 1},
  {&__pyx_n_s_to_python, __pyx_k_to_python, sizeof(__pyx_k_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_to_sympy, __pyx_k_to_sympy, sizeof(__pyx_k_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_truediv, __pyx_k_truediv, sizeof(__pyx_k_truediv), 0, 0, 1, 1},
  {&__pyx_kp_u_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 1, 0, 0},
  {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1},
  {&__pyx_n_s_unevaluated, __pyx_k_unevaluated, sizeof(__pyx_k_unevaluated), 0, 0, 1, 1},
  {&__pyx_n_s_unformatted, __pyx_k_unformatted, sizeof(__pyx_k_unformatted), 0, 0, 1, 1},
  {&__pyx_n_u_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 1, 0, 1},
  {&__pyx_n_s_union, __pyx_k_union, sizeof(__pyx_k_union), 0, 0, 1, 1},
  {&__pyx_n_u_up, __pyx_k_up, sizeof(__pyx_k_up), 0, 1, 0, 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_user, __pyx_k_user, sizeof(__pyx_k_user), 0, 0, 1, 1},
  {&__pyx_n_s_user_hash, __pyx_k_user_hash, sizeof(__pyx_k_user_hash), 0, 0, 1, 1},
  {&__pyx_n_u_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 1, 0, 1},
  {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_valid_context_name, __pyx_k_valid_context_name, sizeof(__pyx_k_valid_context_name), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_kp_u_value_does_not_belongs_to_a_vali, __pyx_k_value_does_not_belongs_to_a_vali, sizeof(__pyx_k_value_does_not_belongs_to_a_vali), 0, 1, 0, 0},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_n_s_var, __pyx_k_var, sizeof(__pyx_k_var), 0, 0, 1, 1},
  {&__pyx_n_s_vars, __pyx_k_vars, sizeof(__pyx_k_vars), 0, 0, 1, 1},
  {&__pyx_kp_u_vert, __pyx_k_vert, sizeof(__pyx_k_vert), 0, 1, 0, 0},
  {&__pyx_kp_u_vert_2, __pyx_k_vert_2, sizeof(__pyx_k_vert_2), 0, 1, 0, 0},
  {&__pyx_kp_u_wedge, __pyx_k_wedge, sizeof(__pyx_k_wedge), 0, 1, 0, 0},
  {&__pyx_kp_u_wedge_2, __pyx_k_wedge_2, sizeof(__pyx_k_wedge_2), 0, 1, 0, 0},
  {&__pyx_n_s_workprec, __pyx_k_workprec, sizeof(__pyx_k_workprec), 0, 0, 1, 1},
  {&__pyx_n_u_xml, __pyx_k_xml, sizeof(__pyx_k_xml), 0, 1, 0, 1},
  {&__pyx_n_u_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 1, 0, 1},
  {&__pyx_n_s_zfill, __pyx_k_zfill, sizeof(__pyx_k_zfill), 0, 0, 1, 1},
  {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 80, __pyx_L1_error)
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 239, __pyx_L1_error)
  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 724, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 75, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 150, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 377, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 730, __pyx_L1_error)
  __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 758, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 871, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 1371, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 2139, __pyx_L1_error)
  __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(0, 2467, __pyx_L1_error)
  __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_n_s_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 3090, __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);

  /* "mathics/core/expression.py":409
 *         superfluous enclosing formats.
 *         """
 *         formats = system_symbols(             # <<<<<<<<<<<<<<
 *             "InputForm",
 *             "OutputForm",
 */
  __pyx_tuple__6 = PyTuple_Pack(7, __pyx_n_u_InputForm, __pyx_n_u_OutputForm, __pyx_n_u_StandardForm, __pyx_n_u_FullForm, __pyx_n_u_TraditionalForm, __pyx_n_u_TeXForm, __pyx_n_u_MathMLForm); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "mathics/core/expression.py":472
 *             # If expr is not an atom, looks for formats in its definition
 *             # and apply them.
 *             def format_expr(expr):             # <<<<<<<<<<<<<<
 *                 if not (expr.is_atom()) and not (expr.head.is_atom()):
 *                     # expr is of the form f[...][...]
 */
  __pyx_tuple__9 = PyTuple_Pack(5, __pyx_n_s_expr, __pyx_n_s_name, __pyx_n_s_formats, __pyx_n_s_rule, __pyx_n_s_result); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);
  __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_format_expr, 472, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 472, __pyx_L1_error)

  /* "mathics/core/expression.py":539
 *     def get_option_values(self, evaluation, allow_symbols=False, stop_on_error=True):
 *         options = self
 *         if options.has_form("List", None):             # <<<<<<<<<<<<<<
 *             options = options.flatten(SymbolList)
 *             values = options.leaves
 */
  __pyx_tuple__11 = PyTuple_Pack(2, __pyx_n_u_List, Py_None); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "mathics/core/expression.py":551
 *                 option_values.update(options)
 *             else:
 *                 if not option.has_form(("Rule", "RuleDelayed"), 2):             # <<<<<<<<<<<<<<
 *                     if stop_on_error:
 *                         return None
 */
  __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_u_Rule, __pyx_n_u_RuleDelayed); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  __pyx_tuple__13 = PyTuple_Pack(2, __pyx_tuple__12, __pyx_int_2); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "mathics/core/expression.py":730
 *     @head.setter
 *     def head(self, value):
 *         raise ValueError("Expression.head is write protected.")             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_Expression_head_is_write_protect); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "mathics/core/expression.py":738
 *     @leaves.setter
 *     def leaves(self, value):
 *         raise ValueError("Expression.leaves is write protected.")             # <<<<<<<<<<<<<<
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_Expression_leaves_is_write_prote); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "mathics/core/expression.py":835
 * 
 *     def flatten_sequence(self, evaluation):
 *         def sequence(leaf):             # <<<<<<<<<<<<<<
 *             if leaf.get_head_name() == "System`Sequence":
 *                 return leaf._leaves
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);
  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sequence, 835, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 835, __pyx_L1_error)

  /* "mathics/core/expression.py":844
 * 
 *     def flatten_pattern_sequence(self, evaluation):
 *         def sequence(leaf):             # <<<<<<<<<<<<<<
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 *             if leaf.get_head_name() == "System`Sequence" and leaf.pattern_sequence:
 */
  __pyx_tuple__18 = PyTuple_Pack(2, __pyx_n_s_leaf, __pyx_n_s_flattened); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);
  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sequence, 844, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 844, __pyx_L1_error)

  /* "mathics/core/expression.py":920
 *             self._format_cache = {}
 * 
 *         last_evaluated, expr = self._format_cache.get(form, (None, None))             # <<<<<<<<<<<<<<
 *         if last_evaluated is not None and expr is not None:
 *             symbolname = expr.get_name()
 */
  __pyx_tuple__20 = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "mathics/core/expression.py":1081
 *         if n_evaluation is not None:
 *             if head_name == "System`Function":
 *                 compiled = Expression("System`Compile", *(self._leaves))             # <<<<<<<<<<<<<<
 *                 compiled = compiled.evaluate(n_evaluation)
 *                 if compiled.get_head_name() == "System`CompiledFunction":
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_System_Compile); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 1081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "mathics/core/expression.py":1216
 *                 for leaf in self._leaves:
 *                     name = leaf.get_name()
 *                     if leaf.has_form("Power", 2):             # <<<<<<<<<<<<<<
 *                         var = leaf._leaves[0].get_name()
 *                         exp = leaf._leaves[1].round_to_float()
 */
  __pyx_tuple__22 = PyTuple_Pack(2, __pyx_n_u_Power, __pyx_int_2); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 1216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "mathics/core/expression.py":1358
 *                 for index in indices:
 *                     leaf = leaves[index]
 *                     if leaf.has_form("Evaluate", 1):             # <<<<<<<<<<<<<<
 *                         leaves[index] = leaf.evaluate(evaluation)
 * 
 */
  __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_u_Evaluate, __pyx_int_1); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 1358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "mathics/core/expression.py":1364
 *             for index in indices:
 *                 leaf = leaves[index]
 *                 if not leaf.has_form("Unevaluated", 1):             # <<<<<<<<<<<<<<
 *                     leaf = leaf.evaluate(evaluation)
 *                     if leaf:
 */
  __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_u_Unevaluated, __pyx_int_1); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "mathics/core/expression.py":1352
 *         leaves = self.get_mutable_leaves()
 * 
 *         def rest_range(indices):             # <<<<<<<<<<<<<<
 *             if "System`HoldAllComplete" not in attributes:
 *                 if self._no_symbol("System`Evaluate"):
 */
  __pyx_tuple__25 = PyTuple_Pack(3, __pyx_n_s_indices, __pyx_n_s_index, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);
  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_rest_range, 1352, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 1352, __pyx_L1_error)

  /* "mathics/core/expression.py":1361
 *                         leaves[index] = leaf.evaluate(evaluation)
 * 
 *         def eval_range(indices):             # <<<<<<<<<<<<<<
 *             for index in indices:
 *                 leaf = leaves[index]
 */
  __pyx_tuple__27 = PyTuple_Pack(3, __pyx_n_s_indices, __pyx_n_s_index, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 1361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_eval_range, 1361, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 1361, __pyx_L1_error)

  /* "mathics/core/expression.py":1410
 *                 leaves = dirty_leaves
 * 
 *         def flatten_callback(new_leaves, old):             # <<<<<<<<<<<<<<
 *             for leaf in new_leaves:
 *                 leaf.unevaluated = old.unevaluated
 */
  __pyx_tuple__29 = PyTuple_Pack(3, __pyx_n_s_new_leaves, __pyx_n_s_old, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_flatten_callback, 1410, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 1410, __pyx_L1_error)

  /* "mathics/core/expression.py":1430
 *                     return threaded, True
 * 
 *         def rules():             # <<<<<<<<<<<<<<
 *             rules_names = set()
 *             if "System`HoldAllComplete" not in attributes:
 */
  __pyx_tuple__31 = PyTuple_Pack(5, __pyx_n_s_rules_names, __pyx_n_s_leaf, __pyx_n_s_name, __pyx_n_s_rule, __pyx_n_s_lookup_name); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_rules, 1430, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 1430, __pyx_L1_error)

  /* "mathics/core/expression.py":1491
 * 
 *     def process_style_box(self, options):
 *         if self.has_form("StyleBox", 1, None):             # <<<<<<<<<<<<<<
 *             rules = self._leaves[1:]
 *             for rule in rules:
 */
  __pyx_tuple__36 = PyTuple_Pack(3, __pyx_n_u_StyleBox, __pyx_int_1, Py_None); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "mathics/core/expression.py":1492
 *     def process_style_box(self, options):
 *         if self.has_form("StyleBox", 1, None):
 *             rules = self._leaves[1:]             # <<<<<<<<<<<<<<
 *             for rule in rules:
 *                 if rule.has_form("Rule", 2):
 */
  __pyx_slice__37 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__37)) __PYX_ERR(0, 1492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__37);
  __Pyx_GIVEREF(__pyx_slice__37);

  /* "mathics/core/expression.py":1494
 *             rules = self._leaves[1:]
 *             for rule in rules:
 *                 if rule.has_form("Rule", 2):             # <<<<<<<<<<<<<<
 *                     name = rule._leaves[0].get_name()
 *                     value = rule._leaves[1]
 */
  __pyx_tuple__38 = PyTuple_Pack(2, __pyx_n_u_Rule, __pyx_int_2); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 1494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "mathics/core/expression.py":1502
 *                         options["show_string_characters"] = value
 *                     elif name == "System`ImageSizeMultipliers":
 *                         if value.has_form("List", 2):             # <<<<<<<<<<<<<<
 *                             m1 = value._leaves[0].round_to_float()
 *                             m2 = value._leaves[1].round_to_float()
 */
  __pyx_tuple__39 = PyTuple_Pack(2, __pyx_n_u_List, __pyx_int_2); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 1502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "mathics/core/expression.py":1516
 *         if is_style:
 *             return self._leaves[0].boxes_to_text(**options)
 *         if self.has_form("RowBox", 1) and self._leaves[0].has_form(  # nopep8             # <<<<<<<<<<<<<<
 *             "List", None
 *         ):
 */
  __pyx_tuple__40 = PyTuple_Pack(2, __pyx_n_u_RowBox, __pyx_int_1); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "mathics/core/expression.py":1522
 *                 [leaf.boxes_to_text(**options) for leaf in self._leaves[0]._leaves]
 *             )
 *         elif self.has_form("SuperscriptBox", 2):             # <<<<<<<<<<<<<<
 *             return "^".join([leaf.boxes_to_text(**options) for leaf in self._leaves])
 *         elif self.has_form("FractionBox", 2):
 */
  __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_u_SuperscriptBox, __pyx_int_2); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 1522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "mathics/core/expression.py":1524
 *         elif self.has_form("SuperscriptBox", 2):
 *             return "^".join([leaf.boxes_to_text(**options) for leaf in self._leaves])
 *         elif self.has_form("FractionBox", 2):             # <<<<<<<<<<<<<<
 *             return "/".join(
 *                 [" ( " + leaf.boxes_to_text(**options) + " ) " for leaf in self._leaves]
 */
  __pyx_tuple__43 = PyTuple_Pack(2, __pyx_n_u_FractionBox, __pyx_int_2); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 1524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "mathics/core/expression.py":1548
 *             def is_list_interior(content):
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]             # <<<<<<<<<<<<<<
 *                 ):
 *                     return True
 */
  __pyx_slice__47 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__47)) __PYX_ERR(0, 1548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__47);
  __Pyx_GIVEREF(__pyx_slice__47);

  /* "mathics/core/expression.py":1546
 *             options = options.copy()
 * 
 *             def is_list_interior(content):             # <<<<<<<<<<<<<<
 *                 if content.has_form("List", None) and all(
 *                     leaf.get_string_value() == "," for leaf in content._leaves[1::2]
 */
  __pyx_tuple__49 = PyTuple_Pack(3, __pyx_n_s_content, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);
  __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_list_interior, 1546, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 1546, __pyx_L1_error)

  /* "mathics/core/expression.py":1609
 * 
 *     def boxes_to_tex(self, **options) -> str:
 *         def block(tex, only_subsup=False):             # <<<<<<<<<<<<<<
 *             if len(tex) == 1:
 *                 return tex
 */
  __pyx_tuple__55 = PyTuple_Pack(2, __pyx_n_s_tex, __pyx_n_s_only_subsup); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);
  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_block, 1609, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __pyx_tuple__57 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "mathics/core/expression.py":1696
 *         new_applied = [False]
 * 
 *         def apply_leaf(leaf):             # <<<<<<<<<<<<<<
 *             new, sub_applied = leaf.apply_rules(rules, evaluation, level + 1, options)
 *             new_applied[0] = new_applied[0] or sub_applied
 */
  __pyx_tuple__61 = PyTuple_Pack(3, __pyx_n_s_leaf, __pyx_n_s_new, __pyx_n_s_sub_applied); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 1696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);
  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_apply_leaf, 1696, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 1696, __pyx_L1_error)

  /* "mathics/core/expression.py":1701
 *             return new
 * 
 *         def descend(expr):             # <<<<<<<<<<<<<<
 *             return Expression(expr._head, *[apply_leaf(leaf) for leaf in expr._leaves])
 * 
 */
  __pyx_tuple__63 = PyTuple_Pack(2, __pyx_n_s_expr, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 1701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_descend, 1701, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 1701, __pyx_L1_error)

  /* "mathics/core/expression.py":1767
 *                     body = body.replace_vars(replacement, options, in_scoping)
 *                     leaves = chain(
 *                         [Expression(SymbolList, *func_params), body], self._leaves[2:]             # <<<<<<<<<<<<<<
 *                     )
 * 
 */
  __pyx_slice__66 = PySlice_New(__pyx_int_2, Py_None, Py_None); if (unlikely(!__pyx_slice__66)) __PYX_ERR(0, 1767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__66);
  __Pyx_GIVEREF(__pyx_slice__66);

  /* "mathics/core/expression.py":1821
 *                     items = [(items + [innerleaf]) for innerleaf in leaf._leaves]
 *                 elif len(leaf._leaves) != dim:
 *                     evaluation.message("Thread", "tdlen")             # <<<<<<<<<<<<<<
 *                     return True, self
 *                 else:
 */
  __pyx_tuple__67 = PyTuple_Pack(2, __pyx_n_u_Thread, __pyx_n_u_tdlen); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 1821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);

  /* "mathics/core/expression.py":1841
 *         return (
 *             self._head.get_name()
 *             in system_symbols(             # <<<<<<<<<<<<<<
 *                 "Sqrt",
 *                 "Times",
 */
  __pyx_tuple__68 = PyTuple_Pack(9, __pyx_n_u_Sqrt, __pyx_n_u_Times, __pyx_n_u_Plus, __pyx_n_u_Subtract, __pyx_n_u_Minus, __pyx_n_u_Power, __pyx_n_u_Abs, __pyx_n_u_Divide, __pyx_n_u_Sin); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 1841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);

  /* "mathics/core/expression.py":2090
 * 
 *     def is_numeric(self) -> bool:
 *         return self.name in system_symbols(             # <<<<<<<<<<<<<<
 *             "Pi", "E", "EulerGamma", "GoldenRatio", "MachinePrecision", "Catalan"
 *         )
 */
  __pyx_tuple__72 = PyTuple_Pack(6, __pyx_n_u_Pi, __pyx_n_u_E, __pyx_n_u_EulerGamma, __pyx_n_u_GoldenRatio, __pyx_n_u_MachinePrecision, __pyx_n_u_Catalan); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 2090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);

  /* "mathics/core/expression.py":2384
 *                 digits = ("".join(re.findall("[0-9]+", value))).lstrip("0")
 *                 if digits == "":  # Handle weird Mathematica zero case
 *                     p = max(prec(len(value.replace("0.", ""))), machine_precision)             # <<<<<<<<<<<<<<
 *                 else:
 *                     p = prec(len(digits.zfill(dps(machine_precision))))
 */
  __pyx_tuple__74 = PyTuple_Pack(2, __pyx_kp_u_0_2, __pyx_kp_u__3); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 2384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);

  /* "mathics/core/expression.py":2428
 *             # binary digits are considered equal"
 *             _prec = min_prec(self, other)
 *             with mpmath.workprec(_prec):             # <<<<<<<<<<<<<<
 *                 rel_eps = 0.5 ** (_prec - 7)
 *                 return mpmath.almosteq(
 */
  __pyx_tuple__76 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 2428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);

  /* "mathics/core/expression.py":2606
 *         self = super().__new__(cls)
 *         if isinstance(real, Complex) or not isinstance(real, Number):
 *             raise ValueError("Argument 'real' must be a real number.")             # <<<<<<<<<<<<<<
 *         if isinstance(imag, Complex) or not isinstance(imag, Number):
 *             raise ValueError("Argument 'imag' must be a real number.")
 */
  __pyx_tuple__77 = PyTuple_Pack(1, __pyx_kp_u_Argument_real_must_be_a_real_num); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 2606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);

  /* "mathics/core/expression.py":2608
 *             raise ValueError("Argument 'real' must be a real number.")
 *         if isinstance(imag, Complex) or not isinstance(imag, Number):
 *             raise ValueError("Argument 'imag' must be a real number.")             # <<<<<<<<<<<<<<
 * 
 *         if imag.sameQ(Integer0):
 */
  __pyx_tuple__78 = PyTuple_Pack(1, __pyx_kp_u_Argument_imag_must_be_a_real_num); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);

  /* "mathics/core/expression.py":2656
 *             result = parts[0]
 *         else:
 *             result = Expression("Plus", *parts)             # <<<<<<<<<<<<<<
 * 
 *         return Expression("HoldForm", result).do_format(evaluation, form)
 */
  __pyx_tuple__79 = PyTuple_Pack(1, __pyx_n_u_Plus); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 2656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);

  /* "mathics/core/expression.py":2787
 * 
 * def encode_tex(text: str, in_text=False) -> str:
 *     def replace(match):             # <<<<<<<<<<<<<<
 *         c = match.group(1)
 *         repl = TEX_TEXT_REPLACE if in_text else TEX_REPLACE
 */
  __pyx_tuple__83 = PyTuple_Pack(3, __pyx_n_s_match, __pyx_n_s_c, __pyx_n_s_repl); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 2787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);
  __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_replace, 2787, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 2787, __pyx_L1_error)

  /* "mathics/core/expression.py":2839
 *             and value.endswith('"')
 *         ):
 *             value = value[1:-1]             # <<<<<<<<<<<<<<
 * 
 *         return value
 */
  __pyx_slice__85 = PySlice_New(__pyx_int_1, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__85)) __PYX_ERR(0, 2839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__85);
  __Pyx_GIVEREF(__pyx_slice__85);

  /* "mathics/core/expression.py":2857
 *         text = self.value
 * 
 *         def render(format, string):             # <<<<<<<<<<<<<<
 *             encoded_text = encode_mathml(string)
 *             return format % encoded_text
 */
  __pyx_tuple__86 = PyTuple_Pack(3, __pyx_n_s_format, __pyx_n_s_string, __pyx_n_s_encoded_text); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 2857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);
  __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_render, 2857, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 2857, __pyx_L1_error)

  /* "mathics/core/expression.py":2903
 *         text = self.value
 * 
 *         def render(format, string, in_text=False):             # <<<<<<<<<<<<<<
 *             return format % encode_tex(string, in_text)
 * 
 */
  __pyx_tuple__91 = PyTuple_Pack(3, __pyx_n_s_format, __pyx_n_s_string, __pyx_n_s_in_text); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 2903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);
  __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_render, 2903, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) __PYX_ERR(0, 2903, __pyx_L1_error)
  __pyx_tuple__93 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 2903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);

  /* "mathics/core/expression.py":2950
 *         inner = str(self.value)
 * 
 *         if f.get_name() in system_symbols("InputForm", "FullForm"):             # <<<<<<<<<<<<<<
 *             inner = inner.replace("\\", "\\\\")
 * 
 */
  __pyx_tuple__104 = PyTuple_Pack(2, __pyx_n_u_InputForm, __pyx_n_u_FullForm); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 2950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);

  /* "mathics/core/expression.py":2951
 * 
 *         if f.get_name() in system_symbols("InputForm", "FullForm"):
 *             inner = inner.replace("\\", "\\\\")             # <<<<<<<<<<<<<<
 * 
 *         return String('"' + inner + '"')
 */
  __pyx_tuple__107 = PyTuple_Pack(2, __pyx_kp_u__105, __pyx_kp_u__106); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 2951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);

  /* "mathics/core/expression.py":2959
 * 
 *     def default_format(self, evaluation, form) -> str:
 *         value = self.value.replace("\\", "\\\\").replace('"', '\\"')             # <<<<<<<<<<<<<<
 *         return '"%s"' % value
 * 
 */
  __pyx_tuple__109 = PyTuple_Pack(2, __pyx_kp_u__81, __pyx_kp_u__108); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 2959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__109);
  __Pyx_GIVEREF(__pyx_tuple__109);

  /* "mathics/core/expression.py":3008
 *             self.value = base64.b64decode(value)
 *         else:
 *             raise Exception("value does not belongs to a valid type")             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__110 = PyTuple_Pack(1, __pyx_kp_u_value_does_not_belongs_to_a_vali); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 3008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);

  /* "mathics/core/expression.py":3132
 *         r = all(
 *             len(definition.get_values_list(x)) == 0
 *             for x in ("up", "sub", "down", "own")             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_tuple__112 = PyTuple_Pack(4, __pyx_n_u_up, __pyx_n_u_sub, __pyx_n_u_down, __pyx_n_u_own); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 3132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);

  /* "mathics/core/expression.py":3193
 *         lower, upper, step = py_slice.indices(len(leaves))
 *         if step != 1:
 *             raise ValueError("Structure.slice only supports slice steps of 1")             # <<<<<<<<<<<<<<
 *         return self(leaves[lower:upper])
 * 
 */
  __pyx_tuple__113 = PyTuple_Pack(1, __pyx_kp_u_Structure_slice_only_supports_sl); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(0, 3193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__113);
  __Pyx_GIVEREF(__pyx_tuple__113);

  /* "mathics/core/expression.py":3255
 *             cache = None
 *     else:
 *         raise ValueError("expected Expression, Structure, tuple or list as orig param")             # <<<<<<<<<<<<<<
 * 
 *     if cache is None:
 */
  __pyx_tuple__114 = PyTuple_Pack(1, __pyx_kp_u_expected_Expression_Structure_tu); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 3255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);

  /* "mathics/core/expression.py":3286
 *     if optimize:
 * 
 *         def construct(leaves):             # <<<<<<<<<<<<<<
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)
 */
  __pyx_tuple__115 = PyTuple_Pack(3, __pyx_n_s_leaves, __pyx_n_s_expr, __pyx_n_s_sym); if (unlikely(!__pyx_tuple__115)) __PYX_ERR(0, 3286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__115);
  __Pyx_GIVEREF(__pyx_tuple__115);
  __pyx_codeobj__116 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__115, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_construct, 3286, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__116)) __PYX_ERR(0, 3286, __pyx_L1_error)

  /* "mathics/core/expression.py":3295
 *     else:
 * 
 *         def construct(leaves):             # <<<<<<<<<<<<<<
 *             expr = Expression(head)
 *             expr._leaves = list(leaves)
 */
  __pyx_tuple__117 = PyTuple_Pack(2, __pyx_n_s_leaves, __pyx_n_s_expr); if (unlikely(!__pyx_tuple__117)) __PYX_ERR(0, 3295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__117);
  __Pyx_GIVEREF(__pyx_tuple__117);
  __pyx_codeobj__118 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__117, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_construct, 3295, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__118)) __PYX_ERR(0, 3295, __pyx_L1_error)

  /* "mathics/core/expression.py":25
 * 
 * 
 * def fully_qualified_symbol_name(name) -> bool:             # <<<<<<<<<<<<<<
 *     return (
 *         isinstance(name, str)
 */
  __pyx_tuple__119 = PyTuple_Pack(1, __pyx_n_s_name); if (unlikely(!__pyx_tuple__119)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__119);
  __Pyx_GIVEREF(__pyx_tuple__119);
  __pyx_codeobj__120 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__119, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_fully_qualified_symbol_name, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__120)) __PYX_ERR(0, 25, __pyx_L1_error)

  /* "mathics/core/expression.py":35
 * 
 * 
 * def valid_context_name(ctx, allow_initial_backquote=False) -> bool:             # <<<<<<<<<<<<<<
 *     return (
 *         isinstance(ctx, str)
 */
  __pyx_tuple__121 = PyTuple_Pack(2, __pyx_n_s_ctx, __pyx_n_s_allow_initial_backquote); if (unlikely(!__pyx_tuple__121)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__121);
  __Pyx_GIVEREF(__pyx_tuple__121);
  __pyx_codeobj__122 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__121, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_valid_context_name, 35, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(0, 35, __pyx_L1_error)
  __pyx_tuple__123 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__123)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__123);
  __Pyx_GIVEREF(__pyx_tuple__123);

  /* "mathics/core/expression.py":44
 * 
 * 
 * def ensure_context(name, context="System`") -> str:             # <<<<<<<<<<<<<<
 *     assert isinstance(name, str)
 *     assert name != ""
 */
  __pyx_tuple__124 = PyTuple_Pack(2, __pyx_n_s_name, __pyx_n_s_context); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_ensure_context, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 44, __pyx_L1_error)
  __pyx_tuple__126 = PyTuple_Pack(1, ((PyObject*)__pyx_kp_u_System)); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);

  /* "mathics/core/expression.py":57
 * 
 * 
 * def strip_context(name) -> str:             # <<<<<<<<<<<<<<
 *     if "`" in name:
 *         return name[name.rindex("`") + 1 :]
 */
  __pyx_tuple__127 = PyTuple_Pack(1, __pyx_n_s_name); if (unlikely(!__pyx_tuple__127)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__127);
  __Pyx_GIVEREF(__pyx_tuple__127);
  __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__127, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_strip_context, 57, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(0, 57, __pyx_L1_error)

  /* "mathics/core/expression.py":64
 * 
 * # system_symbols('A', 'B', ...) -> ['System`A', 'System`B', ...]
 * def system_symbols(*symbols) -> typing.List[str]:             # <<<<<<<<<<<<<<
 *     return [ensure_context(s) for s in symbols]
 * 
 */
  __pyx_tuple__129 = PyTuple_Pack(2, __pyx_n_s_symbols, __pyx_n_s_s_6); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__129);
  __Pyx_GIVEREF(__pyx_tuple__129);
  __pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_system_symbols, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 64, __pyx_L1_error)

  /* "mathics/core/expression.py":69
 * 
 * # system_symbols_dict({'SomeSymbol': ...}) -> {'System`SomeSymbol': ...}
 * def system_symbols_dict(d):             # <<<<<<<<<<<<<<
 *     return {ensure_context(k): v for k, v in d.items()}
 * 
 */
  __pyx_tuple__131 = PyTuple_Pack(3, __pyx_n_s_d, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__131);
  __Pyx_GIVEREF(__pyx_tuple__131);
  __pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_system_symbols_dict, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(0, 69, __pyx_L1_error)

  /* "mathics/core/expression.py":74
 * 
 * class BoxError(Exception):
 *     def __init__(self, box, form) -> None:             # <<<<<<<<<<<<<<
 *         super().__init__("Box %s cannot be formatted as %s" % (box, form))
 *         self.box = box
 */
  __pyx_tuple__133 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_box, __pyx_n_s_form); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);
  __pyx_codeobj__134 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_init, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__134)) __PYX_ERR(0, 74, __pyx_L1_error)

  /* "mathics/core/expression.py":80
 * 
 * 
 * class ExpressionPointer(object):             # <<<<<<<<<<<<<<
 *     def __init__(self, parent, position) -> None:
 *         self.parent = parent
 */
  __pyx_tuple__135 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);

  /* "mathics/core/expression.py":81
 * 
 * class ExpressionPointer(object):
 *     def __init__(self, parent, position) -> None:             # <<<<<<<<<<<<<<
 *         self.parent = parent
 *         self.position = position
 */
  __pyx_tuple__136 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_parent, __pyx_n_s_position); if (unlikely(!__pyx_tuple__136)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__136);
  __Pyx_GIVEREF(__pyx_tuple__136);
  __pyx_codeobj__137 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_init, 81, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__137)) __PYX_ERR(0, 81, __pyx_L1_error)

  /* "mathics/core/expression.py":85
 *         self.position = position
 * 
 *     def replace(self, new) -> None:             # <<<<<<<<<<<<<<
 *         if self.position == 0:
 *             self.parent.set_head(new)
 */
  __pyx_tuple__138 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_new); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__138);
  __Pyx_GIVEREF(__pyx_tuple__138);
  __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_replace, 85, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(0, 85, __pyx_L1_error)

  /* "mathics/core/expression.py":91
 *             self.parent.set_leaf(self.position - 1, new)
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[[%s]]" % (self.parent, self.position)
 * 
 */
  __pyx_tuple__140 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__140)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__140);
  __Pyx_GIVEREF(__pyx_tuple__140);
  __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_str, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(0, 91, __pyx_L1_error)

  /* "mathics/core/expression.py":95
 * 
 * 
 * def from_python(arg):             # <<<<<<<<<<<<<<
 *     """Converts a Python expression into a Mathics expression.
 * 
 */
  __pyx_tuple__142 = PyTuple_Pack(6, __pyx_n_s_arg, __pyx_n_s_BoxConstruct, __pyx_n_s_number_type, __pyx_n_s_entries, __pyx_n_s_key, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__142)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__142);
  __Pyx_GIVEREF(__pyx_tuple__142);
  __pyx_codeobj__143 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_from_python, 95, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__143)) __PYX_ERR(0, 95, __pyx_L1_error)

  /* "mathics/core/expression.py":153
 * 
 * 
 * class KeyComparable(object):             # <<<<<<<<<<<<<<
 *     def get_sort_key(self):
 *         raise NotImplementedError
 */
  __pyx_tuple__144 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__144)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__144);
  __Pyx_GIVEREF(__pyx_tuple__144);

  /* "mathics/core/expression.py":154
 * 
 * class KeyComparable(object):
 *     def get_sort_key(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  __pyx_tuple__145 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__145)) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__145);
  __Pyx_GIVEREF(__pyx_tuple__145);
  __pyx_codeobj__146 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__145, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sort_key, 154, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__146)) __PYX_ERR(0, 154, __pyx_L1_error)

  /* "mathics/core/expression.py":157
 *         raise NotImplementedError
 * 
 *     def __lt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() < other.get_sort_key()
 * 
 */
  __pyx_tuple__147 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__147)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__147);
  __Pyx_GIVEREF(__pyx_tuple__147);
  __pyx_codeobj__148 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__147, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_lt_2, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__148)) __PYX_ERR(0, 157, __pyx_L1_error)

  /* "mathics/core/expression.py":160
 *         return self.get_sort_key() < other.get_sort_key()
 * 
 *     def __gt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() > other.get_sort_key()
 * 
 */
  __pyx_tuple__149 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__149)) __PYX_ERR(0, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__149);
  __Pyx_GIVEREF(__pyx_tuple__149);
  __pyx_codeobj__150 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__149, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_gt_2, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__150)) __PYX_ERR(0, 160, __pyx_L1_error)

  /* "mathics/core/expression.py":163
 *         return self.get_sort_key() > other.get_sort_key()
 * 
 *     def __le__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() <= other.get_sort_key()
 * 
 */
  __pyx_tuple__151 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__151)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__151);
  __Pyx_GIVEREF(__pyx_tuple__151);
  __pyx_codeobj__152 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_le, 163, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__152)) __PYX_ERR(0, 163, __pyx_L1_error)

  /* "mathics/core/expression.py":166
 *         return self.get_sort_key() <= other.get_sort_key()
 * 
 *     def __ge__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() >= other.get_sort_key()
 * 
 */
  __pyx_tuple__153 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__153)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__153);
  __Pyx_GIVEREF(__pyx_tuple__153);
  __pyx_codeobj__154 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_ge, 166, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__154)) __PYX_ERR(0, 166, __pyx_L1_error)

  /* "mathics/core/expression.py":169
 *         return self.get_sort_key() >= other.get_sort_key()
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             hasattr(other, "get_sort_key")
 */
  __pyx_tuple__155 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__155)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__155);
  __Pyx_GIVEREF(__pyx_tuple__155);
  __pyx_codeobj__156 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__155, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_eq, 169, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__156)) __PYX_ERR(0, 169, __pyx_L1_error)

  /* "mathics/core/expression.py":175
 *         )
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             not hasattr(other, "get_sort_key")
 */
  __pyx_tuple__157 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__157)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__157);
  __Pyx_GIVEREF(__pyx_tuple__157);
  __pyx_codeobj__158 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_ne, 175, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__158)) __PYX_ERR(0, 175, __pyx_L1_error)

  /* "mathics/core/expression.py":196
 * 
 * class ExpressionCache:
 *     def __init__(self, time=None, symbols=None, sequences=None, copy=None):             # <<<<<<<<<<<<<<
 *         if copy is not None:
 *             time = time or copy.time
 */
  __pyx_tuple__159 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_time, __pyx_n_s_symbols, __pyx_n_s_sequences, __pyx_n_s_copy); if (unlikely(!__pyx_tuple__159)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__159);
  __Pyx_GIVEREF(__pyx_tuple__159);
  __pyx_codeobj__160 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__159, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_init, 196, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__160)) __PYX_ERR(0, 196, __pyx_L1_error)
  __pyx_tuple__161 = PyTuple_Pack(4, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__161)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__161);
  __Pyx_GIVEREF(__pyx_tuple__161);

  /* "mathics/core/expression.py":205
 *         self.sequences = sequences
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return ExpressionCache(self.time, self.symbols, self.sequences)
 * 
 */
  __pyx_tuple__162 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__162)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__162);
  __Pyx_GIVEREF(__pyx_tuple__162);
  __pyx_codeobj__163 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__162, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_copy, 205, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__163)) __PYX_ERR(0, 205, __pyx_L1_error)

  /* "mathics/core/expression.py":208
 *         return ExpressionCache(self.time, self.symbols, self.sequences)
 * 
 *     def sliced(self, lower, upper):             # <<<<<<<<<<<<<<
 *         # indicates that the Expression's leaves have been slices with
 *         # the given indices.
 */
  __pyx_tuple__164 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_lower, __pyx_n_s_upper, __pyx_n_s_seq, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_new_sequences, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__164)) __PYX_ERR(0, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__164);
  __Pyx_GIVEREF(__pyx_tuple__164);
  __pyx_codeobj__165 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__164, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sliced, 208, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__165)) __PYX_ERR(0, 208, __pyx_L1_error)

  /* "mathics/core/expression.py":225
 *         return ExpressionCache(self.time, self.symbols, new_sequences)
 * 
 *     def reordered(self):             # <<<<<<<<<<<<<<
 *         # indicates that the Expression's leaves have been reordered
 *         # or reduced (i.e. that the leaves have changed, but that
 */
  __pyx_tuple__166 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_sequences); if (unlikely(!__pyx_tuple__166)) __PYX_ERR(0, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__166);
  __Pyx_GIVEREF(__pyx_tuple__166);
  __pyx_codeobj__167 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_reordered, 225, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__167)) __PYX_ERR(0, 225, __pyx_L1_error)

  /* "mathics/core/expression.py":240
 * 
 *     @staticmethod
 *     def union(expressions, evaluation):             # <<<<<<<<<<<<<<
 *         definitions = evaluation.definitions
 * 
 */
  __pyx_tuple__168 = PyTuple_Pack(6, __pyx_n_s_expressions, __pyx_n_s_evaluation, __pyx_n_s_definitions, __pyx_n_s_expr, __pyx_n_s_symbols, __pyx_n_s_expr); if (unlikely(!__pyx_tuple__168)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__168);
  __Pyx_GIVEREF(__pyx_tuple__168);
  __pyx_codeobj__169 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_union, 240, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__169)) __PYX_ERR(0, 240, __pyx_L1_error)

  /* "mathics/core/expression.py":260
 *     last_evaluated: Any
 * 
 *     def __new__(cls, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self = object.__new__(cls)
 *         self.options = None
 */
  __pyx_tuple__170 = PyTuple_Pack(4, __pyx_n_s_cls, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_self); if (unlikely(!__pyx_tuple__170)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__170);
  __Pyx_GIVEREF(__pyx_tuple__170);
  __pyx_codeobj__171 = (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__170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 260, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__171)) __PYX_ERR(0, 260, __pyx_L1_error)

  /* "mathics/core/expression.py":268
 *         return self
 * 
 *     def clear_cache(self):             # <<<<<<<<<<<<<<
 *         self._cache = None
 * 
 */
  __pyx_tuple__172 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__172)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__172);
  __Pyx_GIVEREF(__pyx_tuple__172);
  __pyx_codeobj__173 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_clear_cache, 268, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__173)) __PYX_ERR(0, 268, __pyx_L1_error)

  /* "mathics/core/expression.py":271
 *         self._cache = None
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */
  __pyx_tuple__174 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rhs); if (unlikely(!__pyx_tuple__174)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__174);
  __Pyx_GIVEREF(__pyx_tuple__174);
  __pyx_codeobj__175 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_equal2, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__175)) __PYX_ERR(0, 271, __pyx_L1_error)

  /* "mathics/core/expression.py":286
 *         return None
 * 
 *     def has_changed(self, definitions):             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_tuple__176 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_definitions); if (unlikely(!__pyx_tuple__176)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__176);
  __Pyx_GIVEREF(__pyx_tuple__176);
  __pyx_codeobj__177 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__176, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_has_changed, 286, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__177)) __PYX_ERR(0, 286, __pyx_L1_error)

  /* "mathics/core/expression.py":289
 *         return True
 * 
 *     def sequences(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_tuple__178 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__178)) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__178);
  __Pyx_GIVEREF(__pyx_tuple__178);
  __pyx_codeobj__179 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__178, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sequences, 289, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__179)) __PYX_ERR(0, 289, __pyx_L1_error)

  /* "mathics/core/expression.py":292
 *         return None
 * 
 *     def flatten_sequence(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__180 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__180)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__180);
  __Pyx_GIVEREF(__pyx_tuple__180);
  __pyx_codeobj__181 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__180, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_flatten_sequence_2, 292, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__181)) __PYX_ERR(0, 292, __pyx_L1_error)

  /* "mathics/core/expression.py":295
 *         return self
 * 
 *     def flatten_pattern_sequence(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__182 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__182)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__182);
  __Pyx_GIVEREF(__pyx_tuple__182);
  __pyx_codeobj__183 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__182, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_flatten_pattern_sequence, 295, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__183)) __PYX_ERR(0, 295, __pyx_L1_error)

  /* "mathics/core/expression.py":298
 *         return self
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         return set()
 * 
 */
  __pyx_tuple__184 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_definitions); if (unlikely(!__pyx_tuple__184)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__184);
  __Pyx_GIVEREF(__pyx_tuple__184);
  __pyx_codeobj__185 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_attributes, 298, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__185)) __PYX_ERR(0, 298, __pyx_L1_error)

  /* "mathics/core/expression.py":301
 *         return set()
 * 
 *     def evaluate_next(self, evaluation):             # <<<<<<<<<<<<<<
 *         return self.evaluate(evaluation), False
 * 
 */
  __pyx_tuple__186 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__186)) __PYX_ERR(0, 301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__186);
  __Pyx_GIVEREF(__pyx_tuple__186);
  __pyx_codeobj__187 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__186, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate_next, 301, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__187)) __PYX_ERR(0, 301, __pyx_L1_error)

  /* "mathics/core/expression.py":304
 *         return self.evaluate(evaluation), False
 * 
 *     def evaluate(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */
  __pyx_tuple__188 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__188)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__188);
  __Pyx_GIVEREF(__pyx_tuple__188);
  __pyx_codeobj__189 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate, 304, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__189)) __PYX_ERR(0, 304, __pyx_L1_error)

  /* "mathics/core/expression.py":308
 *         return self
 * 
 *     def get_atoms(self, include_heads=True):             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  __pyx_tuple__190 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_include_heads); if (unlikely(!__pyx_tuple__190)) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__190);
  __Pyx_GIVEREF(__pyx_tuple__190);
  __pyx_codeobj__191 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_atoms, 308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__191)) __PYX_ERR(0, 308, __pyx_L1_error)
  __pyx_tuple__192 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__192)) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__192);
  __Pyx_GIVEREF(__pyx_tuple__192);

  /* "mathics/core/expression.py":311
 *         return []
 * 
 *     def get_name(self):             # <<<<<<<<<<<<<<
 *         "Returns symbol's name if Symbol instance"
 * 
 */
  __pyx_tuple__193 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__193)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__193);
  __Pyx_GIVEREF(__pyx_tuple__193);
  __pyx_codeobj__194 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__193, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_name, 311, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__194)) __PYX_ERR(0, 311, __pyx_L1_error)

  /* "mathics/core/expression.py":316
 *         return ""
 * 
 *     def is_symbol(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_tuple__195 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__195)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__195);
  __Pyx_GIVEREF(__pyx_tuple__195);
  __pyx_codeobj__196 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__195, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_symbol, 316, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__196)) __PYX_ERR(0, 316, __pyx_L1_error)

  /* "mathics/core/expression.py":319
 *         return False
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_tuple__197 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__197)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__197);
  __Pyx_GIVEREF(__pyx_tuple__197);
  __pyx_codeobj__198 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__197, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_machine_precision, 319, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__198)) __PYX_ERR(0, 319, __pyx_L1_error)

  /* "mathics/core/expression.py":322
 *         return False
 * 
 *     def get_lookup_name(self):             # <<<<<<<<<<<<<<
 *         "Returns symbol name of leftmost head"
 * 
 */
  __pyx_tuple__199 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__199)) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__199);
  __Pyx_GIVEREF(__pyx_tuple__199);
  __pyx_codeobj__200 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__199, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_lookup_name, 322, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__200)) __PYX_ERR(0, 322, __pyx_L1_error)

  /* "mathics/core/expression.py":327
 *         return self.get_name()
 * 
 *     def get_head(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_tuple__201 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__201)) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__201);
  __Pyx_GIVEREF(__pyx_tuple__201);
  __pyx_codeobj__202 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__201, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_head, 327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__202)) __PYX_ERR(0, 327, __pyx_L1_error)

  /* "mathics/core/expression.py":330
 *         return None
 * 
 *     def get_head_name(self):             # <<<<<<<<<<<<<<
 *         return self.get_head().get_name()
 * 
 */
  __pyx_tuple__203 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__203)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__203);
  __Pyx_GIVEREF(__pyx_tuple__203);
  __pyx_codeobj__204 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__203, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_head_name, 330, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__204)) __PYX_ERR(0, 330, __pyx_L1_error)

  /* "mathics/core/expression.py":333
 *         return self.get_head().get_name()
 * 
 *     def get_leaves(self):             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  __pyx_tuple__205 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__205)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__205);
  __Pyx_GIVEREF(__pyx_tuple__205);
  __pyx_codeobj__206 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__205, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_leaves, 333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__206)) __PYX_ERR(0, 333, __pyx_L1_error)

  /* "mathics/core/expression.py":336
 *         return []
 * 
 *     def get_int_value(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_tuple__207 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__207)) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__207);
  __Pyx_GIVEREF(__pyx_tuple__207);
  __pyx_codeobj__208 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__207, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_int_value, 336, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__208)) __PYX_ERR(0, 336, __pyx_L1_error)

  /* "mathics/core/expression.py":339
 *         return None
 * 
 *     def get_float_value(self, permit_complex=False):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_tuple__209 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_permit_complex); if (unlikely(!__pyx_tuple__209)) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__209);
  __Pyx_GIVEREF(__pyx_tuple__209);
  __pyx_codeobj__210 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__209, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_float_value, 339, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__210)) __PYX_ERR(0, 339, __pyx_L1_error)
  __pyx_tuple__211 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__211)) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__211);
  __Pyx_GIVEREF(__pyx_tuple__211);

  /* "mathics/core/expression.py":342
 *         return None
 * 
 *     def get_string_value(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_tuple__212 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__212)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__212);
  __Pyx_GIVEREF(__pyx_tuple__212);
  __pyx_codeobj__213 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__212, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_string_value, 342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__213)) __PYX_ERR(0, 342, __pyx_L1_error)

  /* "mathics/core/expression.py":345
 *         return None
 * 
 *     def is_atom(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_tuple__214 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__214)) __PYX_ERR(0, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__214);
  __Pyx_GIVEREF(__pyx_tuple__214);
  __pyx_codeobj__215 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__214, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_atom, 345, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__215)) __PYX_ERR(0, 345, __pyx_L1_error)

  /* "mathics/core/expression.py":348
 *         return False
 * 
 *     def is_true(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_tuple__216 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__216)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__216);
  __Pyx_GIVEREF(__pyx_tuple__216);
  __pyx_codeobj__217 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__216, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_true, 348, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__217)) __PYX_ERR(0, 348, __pyx_L1_error)

  /* "mathics/core/expression.py":351
 *         return False
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         # used by NumericQ and expression ordering
 *         return False
 */
  __pyx_tuple__218 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__218)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__218);
  __Pyx_GIVEREF(__pyx_tuple__218);
  __pyx_codeobj__219 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__218, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_numeric, 351, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__219)) __PYX_ERR(0, 351, __pyx_L1_error)

  /* "mathics/core/expression.py":355
 *         return False
 * 
 *     def has_form(self, heads, *leaf_counts):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_tuple__220 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_heads, __pyx_n_s_leaf_counts); if (unlikely(!__pyx_tuple__220)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__220);
  __Pyx_GIVEREF(__pyx_tuple__220);
  __pyx_codeobj__221 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__220, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_has_form, 355, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__221)) __PYX_ERR(0, 355, __pyx_L1_error)

  /* "mathics/core/expression.py":358
 *         return False
 * 
 *     def flatten(self, head, pattern_only=False, callback=None) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__222 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_head, __pyx_n_s_pattern_only, __pyx_n_s_callback); if (unlikely(!__pyx_tuple__222)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__222);
  __Pyx_GIVEREF(__pyx_tuple__222);
  __pyx_codeobj__223 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__222, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_flatten, 358, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__223)) __PYX_ERR(0, 358, __pyx_L1_error)
  __pyx_tuple__224 = PyTuple_Pack(2, ((PyObject *)Py_False), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__224)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__224);
  __Pyx_GIVEREF(__pyx_tuple__224);

  /* "mathics/core/expression.py":361
 *         return self
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         """
 *         To allow usage of expression as dictionary keys,
 */
  __pyx_tuple__225 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__225)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__225);
  __Pyx_GIVEREF(__pyx_tuple__225);
  __pyx_codeobj__226 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__225, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_hash, 361, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__226)) __PYX_ERR(0, 361, __pyx_L1_error)

  /* "mathics/core/expression.py":368
 *         raise NotImplementedError
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         # whereas __hash__ is for internal Mathics purposes like using Expressions as dictionary keys and fast
 *         # comparison of elements, user_hash is called for Hash[]. user_hash should strive to give stable results
 */
  __pyx_tuple__227 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_update); if (unlikely(!__pyx_tuple__227)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__227);
  __Pyx_GIVEREF(__pyx_tuple__227);
  __pyx_codeobj__228 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__227, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_user_hash, 368, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__228)) __PYX_ERR(0, 368, __pyx_L1_error)

  /* "mathics/core/expression.py":375
 *         raise NotImplementedError
 * 
 *     def sameQ(self, rhs) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return id(self) == id(rhs)
 */
  __pyx_tuple__229 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rhs); if (unlikely(!__pyx_tuple__229)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__229);
  __Pyx_GIVEREF(__pyx_tuple__229);
  __pyx_codeobj__230 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__229, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sameQ, 375, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__230)) __PYX_ERR(0, 375, __pyx_L1_error)

  /* "mathics/core/expression.py":379
 *         return id(self) == id(rhs)
 * 
 *     def get_sequence(self):             # <<<<<<<<<<<<<<
 *         if self.get_head().get_name() == "System`Sequence":
 *             return self.leaves
 */
  __pyx_tuple__231 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__231)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__231);
  __Pyx_GIVEREF(__pyx_tuple__231);
  __pyx_codeobj__232 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__231, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sequence, 379, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__232)) __PYX_ERR(0, 379, __pyx_L1_error)

  /* "mathics/core/expression.py":385
 *             return [self]
 * 
 *     def evaluate_leaves(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__233 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__233)) __PYX_ERR(0, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__233);
  __Pyx_GIVEREF(__pyx_tuple__233);
  __pyx_codeobj__234 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__233, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate_leaves, 385, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__234)) __PYX_ERR(0, 385, __pyx_L1_error)

  /* "mathics/core/expression.py":388
 *         return self
 * 
 *     def apply_rules(             # <<<<<<<<<<<<<<
 *         self, rules, evaluation, level=0, options=None
 *     ) -> typing.Tuple["BaseExpression", bool]:
 */
  __pyx_tuple__235 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_rules, __pyx_n_s_evaluation, __pyx_n_s_level, __pyx_n_s_options, __pyx_n_s_l1, __pyx_n_s_l2, __pyx_n_s_rule, __pyx_n_s_result); if (unlikely(!__pyx_tuple__235)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__235);
  __Pyx_GIVEREF(__pyx_tuple__235);
  __pyx_codeobj__236 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__235, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_apply_rules, 388, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__236)) __PYX_ERR(0, 388, __pyx_L1_error)
  __pyx_tuple__237 = PyTuple_Pack(2, ((PyObject *)__pyx_int_0), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__237)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__237);
  __Pyx_GIVEREF(__pyx_tuple__237);

  /* "mathics/core/expression.py":404
 *         return self, False
 * 
 *     def do_format(self, evaluation, form):             # <<<<<<<<<<<<<<
 *         """
 *         Applies formats associated to the expression and removes
 */
  __pyx_tuple__238 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form, __pyx_n_s_formats, __pyx_n_s_expr, __pyx_n_s_head, __pyx_n_s_leaves, __pyx_n_s_include_form, __pyx_n_s_unformatted, __pyx_n_s_format_expr, __pyx_n_s_format_expr, __pyx_n_s_formatted, __pyx_n_s_result, __pyx_n_s_new_leaves, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__238)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__238);
  __Pyx_GIVEREF(__pyx_tuple__238);
  __pyx_codeobj__239 = (PyObject*)__Pyx_PyCode_New(3, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__238, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_format, 404, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__239)) __PYX_ERR(0, 404, __pyx_L1_error)

  /* "mathics/core/expression.py":516
 *             evaluation.dec_recursion_depth()
 * 
 *     def format(             # <<<<<<<<<<<<<<
 *         self, evaluation, form, **kwargs
 *     ) -> typing.Union["Expression", "Symbol"]:
 */
  __pyx_tuple__240 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form, __pyx_n_s_kwargs, __pyx_n_s_expr, __pyx_n_s_result); if (unlikely(!__pyx_tuple__240)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__240);
  __Pyx_GIVEREF(__pyx_tuple__240);
  __pyx_codeobj__241 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__240, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_format, 516, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__241)) __PYX_ERR(0, 516, __pyx_L1_error)

  /* "mathics/core/expression.py":518
 *     def format(
 *         self, evaluation, form, **kwargs
 *     ) -> typing.Union["Expression", "Symbol"]:             # <<<<<<<<<<<<<<
 *         """
 *         Applies formats associated to the expression, and then calls Makeboxes
 */
  __pyx_tuple__242 = PyTuple_Pack(2, __pyx_n_u_Expression, __pyx_n_u_Symbol); if (unlikely(!__pyx_tuple__242)) __PYX_ERR(0, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__242);
  __Pyx_GIVEREF(__pyx_tuple__242);

  /* "mathics/core/expression.py":526
 *         return result
 * 
 *     def is_free(self, form, evaluation) -> bool:             # <<<<<<<<<<<<<<
 *         from mathics.builtin.patterns import item_is_free
 * 
 */
  __pyx_tuple__243 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_form, __pyx_n_s_evaluation, __pyx_n_s_item_is_free); if (unlikely(!__pyx_tuple__243)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__243);
  __Pyx_GIVEREF(__pyx_tuple__243);
  __pyx_codeobj__244 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__243, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_free, 526, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__244)) __PYX_ERR(0, 526, __pyx_L1_error)

  /* "mathics/core/expression.py":531
 *         return item_is_free(self, form, evaluation)
 * 
 *     def is_inexact(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_precision() is not None
 * 
 */
  __pyx_tuple__245 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__245)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__245);
  __Pyx_GIVEREF(__pyx_tuple__245);
  __pyx_codeobj__246 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__245, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_inexact, 531, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__246)) __PYX_ERR(0, 531, __pyx_L1_error)

  /* "mathics/core/expression.py":534
 *         return self.get_precision() is not None
 * 
 *     def get_precision(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_tuple__247 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__247)) __PYX_ERR(0, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__247);
  __Pyx_GIVEREF(__pyx_tuple__247);
  __pyx_codeobj__248 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__247, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_precision, 534, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__248)) __PYX_ERR(0, 534, __pyx_L1_error)

  /* "mathics/core/expression.py":537
 *         return None
 * 
 *     def get_option_values(self, evaluation, allow_symbols=False, stop_on_error=True):             # <<<<<<<<<<<<<<
 *         options = self
 *         if options.has_form("List", None):
 */
  __pyx_tuple__249 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_allow_symbols, __pyx_n_s_stop_on_error, __pyx_n_s_options, __pyx_n_s_values, __pyx_n_s_option_values, __pyx_n_s_option, __pyx_n_s_symbol_name, __pyx_n_s_name); if (unlikely(!__pyx_tuple__249)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__249);
  __Pyx_GIVEREF(__pyx_tuple__249);
  __pyx_codeobj__250 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__249, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_option_values, 537, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__250)) __PYX_ERR(0, 537, __pyx_L1_error)
  __pyx_tuple__251 = PyTuple_Pack(2, ((PyObject *)Py_False), ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__251)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__251);
  __Pyx_GIVEREF(__pyx_tuple__251);

  /* "mathics/core/expression.py":567
 *         return option_values
 * 
 *     def get_rules_list(self):             # <<<<<<<<<<<<<<
 *         from mathics.core.rules import Rule
 * 
 */
  __pyx_tuple__252 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_Rule, __pyx_n_s_list_expr, __pyx_n_s_list, __pyx_n_s_rules, __pyx_n_s_item, __pyx_n_s_rule); if (unlikely(!__pyx_tuple__252)) __PYX_ERR(0, 567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__252);
  __Pyx_GIVEREF(__pyx_tuple__252);
  __pyx_codeobj__253 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__252, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_rules_list, 567, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__253)) __PYX_ERR(0, 567, __pyx_L1_error)

  /* "mathics/core/expression.py":584
 *         return rules
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  __pyx_tuple__254 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__254)) __PYX_ERR(0, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__254);
  __Pyx_GIVEREF(__pyx_tuple__254);
  __pyx_codeobj__255 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__254, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_sympy, 584, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__255)) __PYX_ERR(0, 584, __pyx_L1_error)

  /* "mathics/core/expression.py":587
 *         raise NotImplementedError
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_tuple__256 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__256)) __PYX_ERR(0, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__256);
  __Pyx_GIVEREF(__pyx_tuple__256);
  __pyx_codeobj__257 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__256, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_mpmath, 587, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__257)) __PYX_ERR(0, 587, __pyx_L1_error)

  /* "mathics/core/expression.py":590
 *         return None
 * 
 *     def round_to_float(self, evaluation=None, permit_complex=False):             # <<<<<<<<<<<<<<
 *         """
 *         Try to round to python float. Return None if not possible.
 */
  __pyx_tuple__258 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_permit_complex, __pyx_n_s_value); if (unlikely(!__pyx_tuple__258)) __PYX_ERR(0, 590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__258);
  __Pyx_GIVEREF(__pyx_tuple__258);
  __pyx_codeobj__259 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__258, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_round_to_float, 590, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__259)) __PYX_ERR(0, 590, __pyx_L1_error)
  __pyx_tuple__260 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__260)) __PYX_ERR(0, 590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__260);
  __Pyx_GIVEREF(__pyx_tuple__260);

  /* "mathics/core/expression.py":602
 *             return value.get_float_value(permit_complex=permit_complex)
 * 
 *     def __abs__(self) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Abs", self)
 * 
 */
  __pyx_tuple__261 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__261)) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__261);
  __Pyx_GIVEREF(__pyx_tuple__261);
  __pyx_codeobj__262 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__261, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_abs, 602, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__262)) __PYX_ERR(0, 602, __pyx_L1_error)

  /* "mathics/core/expression.py":605
 *         return Expression("Abs", self)
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__263 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__263)) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__263);
  __Pyx_GIVEREF(__pyx_tuple__263);
  __pyx_codeobj__264 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__263, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_pos, 605, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__264)) __PYX_ERR(0, 605, __pyx_L1_error)

  /* "mathics/core/expression.py":608
 *         return self
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return Expression("Times", self, -1)
 * 
 */
  __pyx_tuple__265 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__265)) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__265);
  __Pyx_GIVEREF(__pyx_tuple__265);
  __pyx_codeobj__266 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__265, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_neg, 608, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__266)) __PYX_ERR(0, 608, __pyx_L1_error)

  /* "mathics/core/expression.py":611
 *         return Expression("Times", self, -1)
 * 
 *     def __add__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Plus", self, other)
 * 
 */
  __pyx_tuple__267 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__267)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__267);
  __Pyx_GIVEREF(__pyx_tuple__267);
  __pyx_codeobj__268 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__267, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_add, 611, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__268)) __PYX_ERR(0, 611, __pyx_L1_error)

  /* "mathics/core/expression.py":614
 *         return Expression("Plus", self, other)
 * 
 *     def __sub__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Plus", self, Expression("Times", other, -1))
 * 
 */
  __pyx_tuple__269 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__269)) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__269);
  __Pyx_GIVEREF(__pyx_tuple__269);
  __pyx_codeobj__270 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__269, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sub_2, 614, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__270)) __PYX_ERR(0, 614, __pyx_L1_error)

  /* "mathics/core/expression.py":617
 *         return Expression("Plus", self, Expression("Times", other, -1))
 * 
 *     def __mul__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Times", self, other)
 * 
 */
  __pyx_tuple__271 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__271)) __PYX_ERR(0, 617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__271);
  __Pyx_GIVEREF(__pyx_tuple__271);
  __pyx_codeobj__272 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__271, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_mul, 617, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__272)) __PYX_ERR(0, 617, __pyx_L1_error)

  /* "mathics/core/expression.py":620
 *         return Expression("Times", self, other)
 * 
 *     def __truediv__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Divide", self, other)
 * 
 */
  __pyx_tuple__273 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__273)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__273);
  __Pyx_GIVEREF(__pyx_tuple__273);
  __pyx_codeobj__274 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__273, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_truediv, 620, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__274)) __PYX_ERR(0, 620, __pyx_L1_error)

  /* "mathics/core/expression.py":623
 *         return Expression("Divide", self, other)
 * 
 *     def __floordiv__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Floor", Expression("Divide", self, other))
 * 
 */
  __pyx_tuple__275 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__275)) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__275);
  __Pyx_GIVEREF(__pyx_tuple__275);
  __pyx_codeobj__276 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__275, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_floordiv, 623, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__276)) __PYX_ERR(0, 623, __pyx_L1_error)

  /* "mathics/core/expression.py":626
 *         return Expression("Floor", Expression("Divide", self, other))
 * 
 *     def __pow__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Power", self, other)
 * 
 */
  __pyx_tuple__277 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__277)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__277);
  __Pyx_GIVEREF(__pyx_tuple__277);
  __pyx_codeobj__278 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__277, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_pow, 626, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__278)) __PYX_ERR(0, 626, __pyx_L1_error)

  /* "mathics/core/expression.py":630
 * 
 * 
 * class Monomial(object):             # <<<<<<<<<<<<<<
 *     """
 *     An object to sort monomials, used in Expression.get_sort_key and
 */
  __pyx_tuple__279 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__279)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__279);
  __Pyx_GIVEREF(__pyx_tuple__279);

  /* "mathics/core/expression.py":636
 *     """
 * 
 *     def __init__(self, exps_dict):             # <<<<<<<<<<<<<<
 *         self.exps = exps_dict
 * 
 */
  __pyx_tuple__280 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_exps_dict); if (unlikely(!__pyx_tuple__280)) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__280);
  __Pyx_GIVEREF(__pyx_tuple__280);
  __pyx_codeobj__281 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__280, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_init, 636, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__281)) __PYX_ERR(0, 636, __pyx_L1_error)

  /* "mathics/core/expression.py":639
 *         self.exps = exps_dict
 * 
 *     def __lt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) < 0
 * 
 */
  __pyx_tuple__282 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__282)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__282);
  __Pyx_GIVEREF(__pyx_tuple__282);
  __pyx_codeobj__283 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__282, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_lt_2, 639, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__283)) __PYX_ERR(0, 639, __pyx_L1_error)

  /* "mathics/core/expression.py":642
 *         return self.__cmp(other) < 0
 * 
 *     def __gt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) > 0
 * 
 */
  __pyx_tuple__284 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__284)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__284);
  __Pyx_GIVEREF(__pyx_tuple__284);
  __pyx_codeobj__285 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__284, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_gt_2, 642, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__285)) __PYX_ERR(0, 642, __pyx_L1_error)

  /* "mathics/core/expression.py":645
 *         return self.__cmp(other) > 0
 * 
 *     def __le__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) <= 0
 * 
 */
  __pyx_tuple__286 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__286)) __PYX_ERR(0, 645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__286);
  __Pyx_GIVEREF(__pyx_tuple__286);
  __pyx_codeobj__287 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__286, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_le, 645, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__287)) __PYX_ERR(0, 645, __pyx_L1_error)

  /* "mathics/core/expression.py":648
 *         return self.__cmp(other) <= 0
 * 
 *     def __ge__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) >= 0
 * 
 */
  __pyx_tuple__288 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__288)) __PYX_ERR(0, 648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__288);
  __Pyx_GIVEREF(__pyx_tuple__288);
  __pyx_codeobj__289 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__288, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_ge, 648, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__289)) __PYX_ERR(0, 648, __pyx_L1_error)

  /* "mathics/core/expression.py":651
 *         return self.__cmp(other) >= 0
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) == 0
 * 
 */
  __pyx_tuple__290 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__290)) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__290);
  __Pyx_GIVEREF(__pyx_tuple__290);
  __pyx_codeobj__291 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__290, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_eq, 651, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__291)) __PYX_ERR(0, 651, __pyx_L1_error)

  /* "mathics/core/expression.py":654
 *         return self.__cmp(other) == 0
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) != 0
 * 
 */
  __pyx_tuple__292 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__292)) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__292);
  __Pyx_GIVEREF(__pyx_tuple__292);
  __pyx_codeobj__293 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__292, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_ne, 654, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__293)) __PYX_ERR(0, 654, __pyx_L1_error)

  /* "mathics/core/expression.py":657
 *         return self.__cmp(other) != 0
 * 
 *     def __cmp(self, other) -> int:             # <<<<<<<<<<<<<<
 *         self_exps = self.exps.copy()
 *         other_exps = other.exps.copy()
 */
  __pyx_tuple__294 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_other, __pyx_n_s_self_exps, __pyx_n_s_other_exps, __pyx_n_s_var, __pyx_n_s_dec, __pyx_n_s_index, __pyx_n_s_self_len, __pyx_n_s_other_len, __pyx_n_s_self_var, __pyx_n_s_self_exp, __pyx_n_s_other_var, __pyx_n_s_other_exp, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__294)) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__294);
  __Pyx_GIVEREF(__pyx_tuple__294);
  __pyx_codeobj__295 = (PyObject*)__Pyx_PyCode_New(2, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__294, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_cmp, 657, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__295)) __PYX_ERR(0, 657, __pyx_L1_error)

  /* "mathics/core/expression.py":714
 *     _sequences: Any
 * 
 *     def __new__(cls, head, *leaves, **kwargs) -> "Expression":             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if isinstance(head, str):
 */
  __pyx_tuple__296 = PyTuple_Pack(7, __pyx_n_s_cls, __pyx_n_s_head, __pyx_n_s_leaves, __pyx_n_s_kwargs, __pyx_n_s_self, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__296)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__296);
  __Pyx_GIVEREF(__pyx_tuple__296);
  __pyx_codeobj__297 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__296, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 714, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__297)) __PYX_ERR(0, 714, __pyx_L1_error)

  /* "mathics/core/expression.py":725
 * 
 *     @property
 *     def head(self):             # <<<<<<<<<<<<<<
 *         return self._head
 * 
 */
  __pyx_tuple__298 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__298)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__298);
  __Pyx_GIVEREF(__pyx_tuple__298);
  __pyx_codeobj__299 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__298, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_head, 725, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__299)) __PYX_ERR(0, 725, __pyx_L1_error)

  /* "mathics/core/expression.py":729
 * 
 *     @head.setter
 *     def head(self, value):             # <<<<<<<<<<<<<<
 *         raise ValueError("Expression.head is write protected.")
 * 
 */
  __pyx_tuple__300 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__300)) __PYX_ERR(0, 729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__300);
  __Pyx_GIVEREF(__pyx_tuple__300);
  __pyx_codeobj__301 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__300, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_head, 729, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__301)) __PYX_ERR(0, 729, __pyx_L1_error)

  /* "mathics/core/expression.py":733
 * 
 *     @property
 *     def leaves(self):             # <<<<<<<<<<<<<<
 *         return self._leaves
 * 
 */
  __pyx_tuple__302 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__302)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__302);
  __Pyx_GIVEREF(__pyx_tuple__302);
  __pyx_codeobj__303 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__302, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_leaves, 733, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__303)) __PYX_ERR(0, 733, __pyx_L1_error)

  /* "mathics/core/expression.py":737
 * 
 *     @leaves.setter
 *     def leaves(self, value):             # <<<<<<<<<<<<<<
 *         raise ValueError("Expression.leaves is write protected.")
 * 
 */
  __pyx_tuple__304 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__304)) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__304);
  __Pyx_GIVEREF(__pyx_tuple__304);
  __pyx_codeobj__305 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__304, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_leaves, 737, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__305)) __PYX_ERR(0, 737, __pyx_L1_error)

  /* "mathics/core/expression.py":740
 *         raise ValueError("Expression.leaves is write protected.")
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */
  __pyx_tuple__306 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_rhs, __pyx_n_s_equal_heads, __pyx_n_s_item1, __pyx_n_s_item2, __pyx_n_s_result); if (unlikely(!__pyx_tuple__306)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__306);
  __Pyx_GIVEREF(__pyx_tuple__306);
  __pyx_codeobj__307 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__306, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_equal2, 740, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__307)) __PYX_ERR(0, 740, __pyx_L1_error)

  /* "mathics/core/expression.py":767
 *         return None
 * 
 *     def slice(self, head, py_slice, evaluation):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, *self.leaves[py_slice])
 *         return structure(head, self, evaluation).slice(self, py_slice)
 */
  __pyx_tuple__308 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_head, __pyx_n_s_py_slice, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__308)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__308);
  __Pyx_GIVEREF(__pyx_tuple__308);
  __pyx_codeobj__309 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__308, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_slice, 767, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__309)) __PYX_ERR(0, 767, __pyx_L1_error)

  /* "mathics/core/expression.py":771
 *         return structure(head, self, evaluation).slice(self, py_slice)
 * 
 *     def filter(self, head, cond, evaluation):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, [leaf in self.leaves if cond(leaf)])
 *         return structure(head, self, evaluation).filter(self, cond)
 */
  __pyx_tuple__310 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_head, __pyx_n_s_cond, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__310)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__310);
  __Pyx_GIVEREF(__pyx_tuple__310);
  __pyx_codeobj__311 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__310, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_filter, 771, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__311)) __PYX_ERR(0, 771, __pyx_L1_error)

  /* "mathics/core/expression.py":775
 *         return structure(head, self, evaluation).filter(self, cond)
 * 
 *     def restructure(self, head, leaves, evaluation, structure_cache=None, deps=None):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, *leaves)
 * 
 */
  __pyx_tuple__312 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_head, __pyx_n_s_leaves, __pyx_n_s_evaluation, __pyx_n_s_structure_cache, __pyx_n_s_deps, __pyx_n_s_s_6); if (unlikely(!__pyx_tuple__312)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__312);
  __Pyx_GIVEREF(__pyx_tuple__312);
  __pyx_codeobj__313 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__312, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_restructure, 775, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__313)) __PYX_ERR(0, 775, __pyx_L1_error)
  __pyx_tuple__314 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__314)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__314);
  __Pyx_GIVEREF(__pyx_tuple__314);

  /* "mathics/core/expression.py":791
 *         return s(list(leaves))
 * 
 *     def _no_symbol(self, symbol_name):             # <<<<<<<<<<<<<<
 *         # if this return True, it's safe to say that self.leaves or its
 *         # sub leaves contain no Symbol with symbol_name. if this returns
 */
  __pyx_tuple__315 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_symbol_name, __pyx_n_s_cache_2, __pyx_n_s_symbols); if (unlikely(!__pyx_tuple__315)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__315);
  __Pyx_GIVEREF(__pyx_tuple__315);
  __pyx_codeobj__316 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__315, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_no_symbol, 791, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__316)) __PYX_ERR(0, 791, __pyx_L1_error)

  /* "mathics/core/expression.py":806
 *             return False
 * 
 *     def sequences(self):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 *         if cache:
 */
  __pyx_tuple__317 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_cache_2, __pyx_n_s_seq); if (unlikely(!__pyx_tuple__317)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__317);
  __Pyx_GIVEREF(__pyx_tuple__317);
  __pyx_codeobj__318 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__317, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sequences, 806, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__318)) __PYX_ERR(0, 806, __pyx_L1_error)

  /* "mathics/core/expression.py":815
 *         return self._rebuild_cache().sequences
 * 
 *     def _flatten_sequence(self, sequence, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         indices = self.sequences()
 *         if not indices:
 */
  __pyx_tuple__319 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_sequence, __pyx_n_s_evaluation, __pyx_n_s_indices, __pyx_n_s_leaves, __pyx_n_s_flattened, __pyx_n_s_extend, __pyx_n_s_k, __pyx_n_s_i); if (unlikely(!__pyx_tuple__319)) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__319);
  __Pyx_GIVEREF(__pyx_tuple__319);
  __pyx_codeobj__320 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__319, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_flatten_sequence, 815, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__320)) __PYX_ERR(0, 815, __pyx_L1_error)

  /* "mathics/core/expression.py":834
 *         return self.restructure(self._head, flattened, evaluation)
 * 
 *     def flatten_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             if leaf.get_head_name() == "System`Sequence":
 */
  __pyx_tuple__321 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_sequence, __pyx_n_s_sequence); if (unlikely(!__pyx_tuple__321)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__321);
  __Pyx_GIVEREF(__pyx_tuple__321);
  __pyx_codeobj__322 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__321, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_flatten_sequence_2, 834, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__322)) __PYX_ERR(0, 834, __pyx_L1_error)

  /* "mathics/core/expression.py":843
 *         return self._flatten_sequence(sequence, evaluation)
 * 
 *     def flatten_pattern_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 */
  __pyx_tuple__323 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_sequence, __pyx_n_s_sequence, __pyx_n_s_expr); if (unlikely(!__pyx_tuple__323)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__323);
  __Pyx_GIVEREF(__pyx_tuple__323);
  __pyx_codeobj__324 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__323, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_flatten_pattern_sequence, 843, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__324)) __PYX_ERR(0, 843, __pyx_L1_error)

  /* "mathics/core/expression.py":856
 *         return expr
 * 
 *     def _rebuild_cache(self):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 * 
 */
  __pyx_tuple__325 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_cache_2, __pyx_n_s_time, __pyx_n_s_sym, __pyx_n_s_seq, __pyx_n_s_i, __pyx_n_s_leaf, __pyx_n_s_leaf_symbols); if (unlikely(!__pyx_tuple__325)) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__325);
  __Pyx_GIVEREF(__pyx_tuple__325);
  __pyx_codeobj__326 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__325, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_rebuild_cache, 856, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__326)) __PYX_ERR(0, 856, __pyx_L1_error)

  /* "mathics/core/expression.py":884
 *         return cache
 * 
 *     def has_changed(self, definitions):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 * 
 */
  __pyx_tuple__327 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_definitions, __pyx_n_s_cache_2, __pyx_n_s_time); if (unlikely(!__pyx_tuple__327)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__327);
  __Pyx_GIVEREF(__pyx_tuple__327);
  __pyx_codeobj__328 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__327, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_has_changed, 884, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__328)) __PYX_ERR(0, 884, __pyx_L1_error)

  /* "mathics/core/expression.py":900
 *         return definitions.has_changed(time, cache.symbols)
 * 
 *     def _timestamp_cache(self, evaluation):             # <<<<<<<<<<<<<<
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)
 * 
 */
  __pyx_tuple__329 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__329)) __PYX_ERR(0, 900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__329);
  __Pyx_GIVEREF(__pyx_tuple__329);
  __pyx_codeobj__330 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_timestamp_cache, 900, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__330)) __PYX_ERR(0, 900, __pyx_L1_error)

  /* "mathics/core/expression.py":903
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)
 * 
 *     def copy(self, reevaluate=False) -> "Expression":             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)
 */
  __pyx_tuple__331 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_reevaluate, __pyx_n_s_expr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__331)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__331);
  __Pyx_GIVEREF(__pyx_tuple__331);
  __pyx_codeobj__332 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__331, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_copy, 903, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__332)) __PYX_ERR(0, 903, __pyx_L1_error)
  __pyx_tuple__333 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__333)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__333);
  __Pyx_GIVEREF(__pyx_tuple__333);

  /* "mathics/core/expression.py":916
 *         return expr
 * 
 *     def do_format(self, evaluation, form):             # <<<<<<<<<<<<<<
 *         if self._format_cache is None:
 *             self._format_cache = {}
 */
  __pyx_tuple__334 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form, __pyx_n_s_last_evaluated, __pyx_n_s_expr, __pyx_n_s_symbolname); if (unlikely(!__pyx_tuple__334)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__334);
  __Pyx_GIVEREF(__pyx_tuple__334);
  __pyx_codeobj__335 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__334, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_format, 916, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__335)) __PYX_ERR(0, 916, __pyx_L1_error)

  /* "mathics/core/expression.py":932
 *         return expr
 * 
 *     def shallow_copy(self) -> "Expression":             # <<<<<<<<<<<<<<
 *         # this is a minimal, shallow copy: head, leaves are shared with
 *         # the original, only the Expression instance is new.
 */
  __pyx_tuple__336 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_expr); if (unlikely(!__pyx_tuple__336)) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__336);
  __Pyx_GIVEREF(__pyx_tuple__336);
  __pyx_codeobj__337 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__336, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_shallow_copy, 932, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__337)) __PYX_ERR(0, 932, __pyx_L1_error)

  /* "mathics/core/expression.py":944
 *         return expr
 * 
 *     def set_positions(self, position=None) -> None:             # <<<<<<<<<<<<<<
 *         self.position = position
 *         self._head.set_positions(ExpressionPointer(self, 0))
 */
  __pyx_tuple__338 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_position, __pyx_n_s_index, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__338)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__338);
  __Pyx_GIVEREF(__pyx_tuple__338);
  __pyx_codeobj__339 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__338, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_set_positions, 944, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__339)) __PYX_ERR(0, 944, __pyx_L1_error)
  __pyx_tuple__340 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__340)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__340);
  __Pyx_GIVEREF(__pyx_tuple__340);

  /* "mathics/core/expression.py":950
 *             leaf.set_positions(ExpressionPointer(self, index + 1))
 * 
 *     def get_head(self):             # <<<<<<<<<<<<<<
 *         return self._head
 * 
 */
  __pyx_tuple__341 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__341)) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__341);
  __Pyx_GIVEREF(__pyx_tuple__341);
  __pyx_codeobj__342 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__341, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_head, 950, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__342)) __PYX_ERR(0, 950, __pyx_L1_error)

  /* "mathics/core/expression.py":953
 *         return self._head
 * 
 *     def set_head(self, head):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = None
 */
  __pyx_tuple__343 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_head); if (unlikely(!__pyx_tuple__343)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__343);
  __Pyx_GIVEREF(__pyx_tuple__343);
  __pyx_codeobj__344 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__343, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_set_head, 953, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__344)) __PYX_ERR(0, 953, __pyx_L1_error)

  /* "mathics/core/expression.py":957
 *         self._cache = None
 * 
 *     def get_leaves(self):             # <<<<<<<<<<<<<<
 *         return self._leaves
 * 
 */
  __pyx_tuple__345 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__345)) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__345);
  __Pyx_GIVEREF(__pyx_tuple__345);
  __pyx_codeobj__346 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__345, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_leaves, 957, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__346)) __PYX_ERR(0, 957, __pyx_L1_error)

  /* "mathics/core/expression.py":960
 *         return self._leaves
 * 
 *     def get_mutable_leaves(self):  # shallow, mutable copy of the leaves array             # <<<<<<<<<<<<<<
 *         return list(self._leaves)
 * 
 */
  __pyx_tuple__347 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__347)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__347);
  __Pyx_GIVEREF(__pyx_tuple__347);
  __pyx_codeobj__348 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__347, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_mutable_leaves, 960, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__348)) __PYX_ERR(0, 960, __pyx_L1_error)

  /* "mathics/core/expression.py":963
 *         return list(self._leaves)
 * 
 *     def set_leaf(self, index, value):  # leaves are removed, added or replaced             # <<<<<<<<<<<<<<
 *         leaves = list(self._leaves)
 *         leaves[index] = value
 */
  __pyx_tuple__349 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_index, __pyx_n_s_value, __pyx_n_s_leaves); if (unlikely(!__pyx_tuple__349)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__349);
  __Pyx_GIVEREF(__pyx_tuple__349);
  __pyx_codeobj__350 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__349, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_set_leaf, 963, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__350)) __PYX_ERR(0, 963, __pyx_L1_error)

  /* "mathics/core/expression.py":969
 *         self._cache = None
 * 
 *     def set_reordered_leaves(self, leaves):  # same leaves, but in a different order             # <<<<<<<<<<<<<<
 *         self._leaves = tuple(leaves)
 *         if self._cache:
 */
  __pyx_tuple__351 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_leaves); if (unlikely(!__pyx_tuple__351)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__351);
  __Pyx_GIVEREF(__pyx_tuple__351);
  __pyx_codeobj__352 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__351, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_set_reordered_leaves, 969, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__352)) __PYX_ERR(0, 969, __pyx_L1_error)

  /* "mathics/core/expression.py":974
 *             self._cache = self._cache.reordered()
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:
 *             res = self._leaves[2]
 */
  __pyx_tuple__353 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_definitions, __pyx_n_s_res, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__353)) __PYX_ERR(0, 974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__353);
  __Pyx_GIVEREF(__pyx_tuple__353);
  __pyx_codeobj__354 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__353, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_attributes, 974, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__354)) __PYX_ERR(0, 974, __pyx_L1_error)

  /* "mathics/core/expression.py":983
 *         return set()
 * 
 *     def get_lookup_name(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self._head.get_lookup_name()
 * 
 */
  __pyx_tuple__355 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__355)) __PYX_ERR(0, 983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__355);
  __Pyx_GIVEREF(__pyx_tuple__355);
  __pyx_codeobj__356 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__355, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_lookup_name, 983, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__356)) __PYX_ERR(0, 983, __pyx_L1_error)

  /* "mathics/core/expression.py":986
 *         return self._head.get_lookup_name()
 * 
 *     def has_form(self, heads, *leaf_counts):             # <<<<<<<<<<<<<<
 *         """
 *         leaf_counts:
 */
  __pyx_tuple__357 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_heads, __pyx_n_s_leaf_counts, __pyx_n_s_head_name, __pyx_n_s_count, __pyx_n_s_h); if (unlikely(!__pyx_tuple__357)) __PYX_ERR(0, 986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__357);
  __Pyx_GIVEREF(__pyx_tuple__357);
  __pyx_codeobj__358 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__357, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_has_form, 986, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__358)) __PYX_ERR(0, 986, __pyx_L1_error)

  /* "mathics/core/expression.py":1017
 *         return True
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         if self._no_symbol(symbol_name):
 *             return False
 */
  __pyx_tuple__359 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_symbol_name, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__359)) __PYX_ERR(0, 1017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__359);
  __Pyx_GIVEREF(__pyx_tuple__359);
  __pyx_codeobj__360 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__359, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_has_symbol, 1017, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__360)) __PYX_ERR(0, 1017, __pyx_L1_error)

  /* "mathics/core/expression.py":1024
 *         )
 * 
 *     def _as_sympy_function(self, **kwargs) -> sympy.Function:             # <<<<<<<<<<<<<<
 *         sym_args = [leaf.to_sympy(**kwargs) for leaf in self.leaves]
 * 
 */
  __pyx_tuple__361 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_kwargs, __pyx_n_s_sym_args, __pyx_n_s_f, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__361)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__361);
  __Pyx_GIVEREF(__pyx_tuple__361);
  __pyx_codeobj__362 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__361, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_as_sympy_function, 1024, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__362)) __PYX_ERR(0, 1024, __pyx_L1_error)

  /* "mathics/core/expression.py":1033
 *         return f(*sym_args)
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         from mathics.builtin import mathics_to_sympy
 * 
 */
  __pyx_tuple__363 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_kwargs, __pyx_n_s_mathics_to_sympy, __pyx_n_s_functions, __pyx_n_s_sym_args, __pyx_n_s_func, __pyx_n_s_lookup_name, __pyx_n_s_builtin, __pyx_n_s_sympy_expr, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__363)) __PYX_ERR(0, 1033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__363);
  __Pyx_GIVEREF(__pyx_tuple__363);
  __pyx_codeobj__364 = (PyObject*)__Pyx_PyCode_New(1, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__363, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_sympy, 1033, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__364)) __PYX_ERR(0, 1033, __pyx_L1_error)

  /* "mathics/core/expression.py":1061
 *         return SympyExpression(self)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Convert the Expression to a Python object:
 */
  __pyx_tuple__365 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_mathics_to_python, __pyx_n_s_n_evaluation, __pyx_n_s_head_name, __pyx_n_s_compiled, __pyx_n_s_value, __pyx_n_s_direction, __pyx_n_s_py_obj, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__365)) __PYX_ERR(0, 1061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__365);
  __Pyx_GIVEREF(__pyx_tuple__365);
  __pyx_codeobj__366 = (PyObject*)__Pyx_PyCode_New(1, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__365, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_python, 1061, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__366)) __PYX_ERR(0, 1061, __pyx_L1_error)

  /* "mathics/core/expression.py":1110
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 * 
 *         if pattern_sort:
 */
  __pyx_tuple__367 = PyTuple_Pack(16, __pyx_n_s_self, __pyx_n_s_pattern_sort, __pyx_n_s_name, __pyx_n_s_pattern, __pyx_n_s_sub, __pyx_n_s_min_key, __pyx_n_s_min, __pyx_n_s_leaf, __pyx_n_s_key, __pyx_n_s_exps, __pyx_n_s_head, __pyx_n_s_var, __pyx_n_s_exp, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__367)) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__367);
  __Pyx_GIVEREF(__pyx_tuple__367);
  __pyx_codeobj__368 = (PyObject*)__Pyx_PyCode_New(2, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__367, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sort_key, 1110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__368)) __PYX_ERR(0, 1110, __pyx_L1_error)
  __pyx_tuple__369 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__369)) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__369);
  __Pyx_GIVEREF(__pyx_tuple__369);

  /* "mathics/core/expression.py":1241
 *                 return [1 if self.is_numeric() else 2, 3, self._head, self._leaves, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if id(self) == id(other):
 */
  __pyx_tuple__370 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_other, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__370)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__370);
  __Pyx_GIVEREF(__pyx_tuple__370);
  __pyx_codeobj__371 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__370, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sameQ, 1241, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__371)) __PYX_ERR(0, 1241, __pyx_L1_error)

  /* "mathics/core/expression.py":1256
 *         return True
 * 
 *     def flatten(             # <<<<<<<<<<<<<<
 *         self, head, pattern_only=False, callback=None, level=None
 *     ) -> "Expression":
 */
  __pyx_tuple__372 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_head, __pyx_n_s_pattern_only, __pyx_n_s_callback, __pyx_n_s_level, __pyx_n_s_sub_level, __pyx_n_s_do_flatten, __pyx_n_s_leaf, __pyx_n_s_new_leaves, __pyx_n_s_new_leaf); if (unlikely(!__pyx_tuple__372)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__372);
  __Pyx_GIVEREF(__pyx_tuple__372);
  __pyx_codeobj__373 = (PyObject*)__Pyx_PyCode_New(5, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__372, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_flatten, 1256, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__373)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __pyx_tuple__374 = PyTuple_Pack(3, ((PyObject *)Py_False), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__374)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__374);
  __Pyx_GIVEREF(__pyx_tuple__374);

  /* "mathics/core/expression.py":1289
 *             return self
 * 
 *     def evaluate(self, evaluation) -> typing.Union["Expression", "Symbol"]:             # <<<<<<<<<<<<<<
 *         from mathics.core.evaluation import ReturnInterrupt
 * 
 */
  __pyx_tuple__375 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_ReturnInterrupt, __pyx_n_s_expr, __pyx_n_s_reevaluate, __pyx_n_s_limit, __pyx_n_s_iteration, __pyx_n_s_names, __pyx_n_s_definitions, __pyx_n_s_old_options, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__375)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__375);
  __Pyx_GIVEREF(__pyx_tuple__375);
  __pyx_codeobj__376 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__375, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate, 1289, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__376)) __PYX_ERR(0, 1289, __pyx_L1_error)

  /* "mathics/core/expression.py":1345
 *         return expr
 * 
 *     def evaluate_next(self, evaluation) -> typing.Tuple["Expression", bool]:             # <<<<<<<<<<<<<<
 *         from mathics.builtin.base import BoxConstruct
 * 
 */
  __pyx_tuple__377 = PyTuple_Pack(22, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_BoxConstruct, __pyx_n_s_head, __pyx_n_s_attributes, __pyx_n_s_leaves, __pyx_n_s_rest_range, __pyx_n_s_rest_range, __pyx_n_s_eval_range, __pyx_n_s_eval_range, __pyx_n_s_new, __pyx_n_s_leaf, __pyx_n_s_dirty_leaves, __pyx_n_s_index, __pyx_n_s_flatten_callback, __pyx_n_s_flatten_callback, __pyx_n_s_done, __pyx_n_s_threaded, __pyx_n_s_rules, __pyx_n_s_rules, __pyx_n_s_rule, __pyx_n_s_result); if (unlikely(!__pyx_tuple__377)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__377);
  __Pyx_GIVEREF(__pyx_tuple__377);
  __pyx_codeobj__378 = (PyObject*)__Pyx_PyCode_New(2, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__377, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate_next, 1345, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__378)) __PYX_ERR(0, 1345, __pyx_L1_error)

  /* "mathics/core/expression.py":1476
 *         return new, False
 * 
 *     def evaluate_leaves(self, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         leaves = [leaf.evaluate(evaluation) for leaf in self._leaves]
 *         head = self._head.evaluate_leaves(evaluation)
 */
  __pyx_tuple__379 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_leaves, __pyx_n_s_head, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__379)) __PYX_ERR(0, 1476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__379);
  __Pyx_GIVEREF(__pyx_tuple__379);
  __pyx_codeobj__380 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__379, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate_leaves, 1476, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__380)) __PYX_ERR(0, 1476, __pyx_L1_error)

  /* "mathics/core/expression.py":1481
 *         return Expression(head, *leaves)
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[%s]" % (
 *             self._head,
 */
  __pyx_tuple__381 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__381)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__381);
  __Pyx_GIVEREF(__pyx_tuple__381);
  __pyx_codeobj__382 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__381, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_str, 1481, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__382)) __PYX_ERR(0, 1481, __pyx_L1_error)

  /* "mathics/core/expression.py":1487
 *         )
 * 
 *     def __repr__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "<Expression: %s>" % self
 * 
 */
  __pyx_tuple__383 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__383)) __PYX_ERR(0, 1487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__383);
  __Pyx_GIVEREF(__pyx_tuple__383);
  __pyx_codeobj__384 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__383, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_repr, 1487, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__384)) __PYX_ERR(0, 1487, __pyx_L1_error)

  /* "mathics/core/expression.py":1490
 *         return "<Expression: %s>" % self
 * 
 *     def process_style_box(self, options):             # <<<<<<<<<<<<<<
 *         if self.has_form("StyleBox", 1, None):
 *             rules = self._leaves[1:]
 */
  __pyx_tuple__385 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_options, __pyx_n_s_rules, __pyx_n_s_rule, __pyx_n_s_name, __pyx_n_s_value, __pyx_n_s_m1, __pyx_n_s_m2); if (unlikely(!__pyx_tuple__385)) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__385);
  __Pyx_GIVEREF(__pyx_tuple__385);
  __pyx_codeobj__386 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__385, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_process_style_box, 1490, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__386)) __PYX_ERR(0, 1490, __pyx_L1_error)

  /* "mathics/core/expression.py":1512
 *             return False, options
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 */
  __pyx_tuple__387 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_options, __pyx_n_s_is_style, __pyx_n_s_leaf, __pyx_n_s_leaf, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__387)) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__387);
  __Pyx_GIVEREF(__pyx_tuple__387);
  __pyx_codeobj__388 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__387, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_text, 1512, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__388)) __PYX_ERR(0, 1512, __pyx_L1_error)

  /* "mathics/core/expression.py":1531
 *             raise BoxError(self, "text")
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 */
  __pyx_tuple__389 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_options, __pyx_n_s_is_style, __pyx_n_s_name, __pyx_n_s_result, __pyx_n_s_inside_row, __pyx_n_s_is_list_interior, __pyx_n_s_is_list_interior, __pyx_n_s_is_list_row, __pyx_n_s_content, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__389)) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__389);
  __Pyx_GIVEREF(__pyx_tuple__389);
  __pyx_codeobj__390 = (PyObject*)__Pyx_PyCode_New(1, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__389, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_mathml, 1531, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__390)) __PYX_ERR(0, 1531, __pyx_L1_error)

  /* "mathics/core/expression.py":1608
 *                 raise BoxError(self, "xml")
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         def block(tex, only_subsup=False):
 *             if len(tex) == 1:
 */
  __pyx_tuple__391 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_options, __pyx_n_s_block, __pyx_n_s_block, __pyx_n_s_is_style, __pyx_n_s_name, __pyx_n_s_tex1, __pyx_n_s_sup_string, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__391)) __PYX_ERR(0, 1608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__391);
  __Pyx_GIVEREF(__pyx_tuple__391);
  __pyx_codeobj__392 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__391, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_tex, 1608, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__392)) __PYX_ERR(0, 1608, __pyx_L1_error)

  /* "mathics/core/expression.py":1663
 *             raise BoxError(self, "tex")
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[%s]" % (
 *             self._head.default_format(evaluation, form),
 */
  __pyx_tuple__393 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__393)) __PYX_ERR(0, 1663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__393);
  __Pyx_GIVEREF(__pyx_tuple__393);
  __pyx_codeobj__394 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__393, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_default_format, 1663, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__394)) __PYX_ERR(0, 1663, __pyx_L1_error)

  /* "mathics/core/expression.py":1669
 *         )
 * 
 *     def sort(self, pattern=False):             # <<<<<<<<<<<<<<
 *         "Sort the leaves according to internal ordering."
 *         leaves = list(self._leaves)
 */
  __pyx_tuple__395 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_pattern, __pyx_n_s_leaves); if (unlikely(!__pyx_tuple__395)) __PYX_ERR(0, 1669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__395);
  __Pyx_GIVEREF(__pyx_tuple__395);
  __pyx_codeobj__396 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__395, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sort, 1669, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__396)) __PYX_ERR(0, 1669, __pyx_L1_error)
  __pyx_tuple__397 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__397)) __PYX_ERR(0, 1669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__397);
  __Pyx_GIVEREF(__pyx_tuple__397);

  /* "mathics/core/expression.py":1678
 *         self.set_reordered_leaves(leaves)
 * 
 *     def filter_leaves(self, head_name):             # <<<<<<<<<<<<<<
 *         # TODO: should use sorting
 *         head_name = ensure_context(head_name)
 */
  __pyx_tuple__398 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_head_name, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__398)) __PYX_ERR(0, 1678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__398);
  __Pyx_GIVEREF(__pyx_tuple__398);
  __pyx_codeobj__399 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__398, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_filter_leaves, 1678, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__399)) __PYX_ERR(0, 1678, __pyx_L1_error)

  /* "mathics/core/expression.py":1687
 *             return [leaf for leaf in self._leaves if leaf.get_head_name() == head_name]
 * 
 *     def apply_rules(self, rules, evaluation, level=0, options=None):             # <<<<<<<<<<<<<<
 *         """for rule in rules:
 *         result = rule.apply(self, evaluation, fully=False)
 */
  __pyx_tuple__400 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_rules, __pyx_n_s_evaluation, __pyx_n_s_level, __pyx_n_s_options, __pyx_n_s_new_applied, __pyx_n_s_apply_leaf, __pyx_n_s_apply_leaf, __pyx_n_s_descend, __pyx_n_s_descend, __pyx_n_s_result, __pyx_n_s_applied, __pyx_n_s_head, __pyx_n_s_expr); if (unlikely(!__pyx_tuple__400)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__400);
  __Pyx_GIVEREF(__pyx_tuple__400);
  __pyx_codeobj__401 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__400, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_apply_rules, 1687, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__401)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __pyx_tuple__402 = PyTuple_Pack(2, ((PyObject *)__pyx_int_0), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__402)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__402);
  __Pyx_GIVEREF(__pyx_tuple__402);

  /* "mathics/core/expression.py":1726
 *             return expr, new_applied[0]
 * 
 *     def replace_vars(             # <<<<<<<<<<<<<<
 *         self, vars, options=None, in_scoping=True, in_function=True
 *     ) -> "Expression":
 */
  __pyx_tuple__403 = PyTuple_Pack(19, __pyx_n_s_self, __pyx_n_s_vars, __pyx_n_s_options, __pyx_n_s_in_scoping, __pyx_n_s_in_function, __pyx_n_s_get_scoping_vars, __pyx_n_s_scoping_vars, __pyx_n_s_leaves, __pyx_n_s_func_params, __pyx_n_s_body, __pyx_n_s_replacement, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_var, __pyx_n_s_value, __pyx_n_s_leaf, __pyx_n_s_name, __pyx_n_s_name, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__403)) __PYX_ERR(0, 1726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__403);
  __Pyx_GIVEREF(__pyx_tuple__403);
  __pyx_codeobj__404 = (PyObject*)__Pyx_PyCode_New(5, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__403, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_replace_vars, 1726, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__404)) __PYX_ERR(0, 1726, __pyx_L1_error)
  __pyx_tuple__405 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_True), ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__405)) __PYX_ERR(0, 1726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__405);
  __Pyx_GIVEREF(__pyx_tuple__405);

  /* "mathics/core/expression.py":1781
 *         )
 * 
 *     def replace_slots(self, slots, evaluation):             # <<<<<<<<<<<<<<
 *         if self._head.get_name() == "System`Slot":
 *             if len(self._leaves) != 1:
 */
  __pyx_tuple__406 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_slots, __pyx_n_s_evaluation, __pyx_n_s_slot, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__406)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__406);
  __Pyx_GIVEREF(__pyx_tuple__406);
  __pyx_codeobj__407 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__406, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_replace_slots, 1781, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__407)) __PYX_ERR(0, 1781, __pyx_L1_error)

  /* "mathics/core/expression.py":1809
 *         )
 * 
 *     def thread(self, evaluation, head=None) -> typing.Tuple[bool, "Expression"]:             # <<<<<<<<<<<<<<
 *         if head is None:
 *             head = Symbol("List")
 */
  __pyx_tuple__408 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_head, __pyx_n_s_items, __pyx_n_s_dim, __pyx_n_s_leaf, __pyx_n_s_index, __pyx_n_s_item, __pyx_n_s_leaves, __pyx_n_s_innerleaf, __pyx_n_s_item); if (unlikely(!__pyx_tuple__408)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__408);
  __Pyx_GIVEREF(__pyx_tuple__408);
  __pyx_codeobj__409 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__408, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_thread, 1809, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__409)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __pyx_tuple__410 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__410)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__410);
  __Pyx_GIVEREF(__pyx_tuple__410);

  /* "mathics/core/expression.py":1838
 *             return True, Expression(head, *leaves)
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             self._head.get_name()
 */
  __pyx_tuple__411 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__411)) __PYX_ERR(0, 1838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__411);
  __Pyx_GIVEREF(__pyx_tuple__411);
  __pyx_codeobj__412 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__411, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_numeric, 1838, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__412)) __PYX_ERR(0, 1838, __pyx_L1_error)

  /* "mathics/core/expression.py":1857
 *         # attribute
 * 
 *     def numerify(self, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         _prec = None
 *         for leaf in self._leaves:
 */
  __pyx_tuple__413 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_prec_2, __pyx_n_s_leaf, __pyx_n_s_leaf_prec, __pyx_n_s_new_leaves, __pyx_n_s_index, __pyx_n_s_n_expr, __pyx_n_s_n_result); if (unlikely(!__pyx_tuple__413)) __PYX_ERR(0, 1857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__413);
  __Pyx_GIVEREF(__pyx_tuple__413);
  __pyx_codeobj__414 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__413, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_numerify, 1857, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__414)) __PYX_ERR(0, 1857, __pyx_L1_error)

  /* "mathics/core/expression.py":1880
 *             return self
 * 
 *     def get_atoms(self, include_heads=True):             # <<<<<<<<<<<<<<
 *         if include_heads:
 *             atoms = self._head.get_atoms()
 */
  __pyx_tuple__415 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_include_heads, __pyx_n_s_atoms, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__415)) __PYX_ERR(0, 1880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__415);
  __Pyx_GIVEREF(__pyx_tuple__415);
  __pyx_codeobj__416 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__415, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_atoms, 1880, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__416)) __PYX_ERR(0, 1880, __pyx_L1_error)
  __pyx_tuple__417 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__417)) __PYX_ERR(0, 1880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__417);
  __Pyx_GIVEREF(__pyx_tuple__417);

  /* "mathics/core/expression.py":1889
 *         return atoms
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Expression", self._head) + tuple(self._leaves))
 * 
 */
  __pyx_tuple__418 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__418)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__418);
  __Pyx_GIVEREF(__pyx_tuple__418);
  __pyx_codeobj__419 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__418, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_hash, 1889, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__419)) __PYX_ERR(0, 1889, __pyx_L1_error)

  /* "mathics/core/expression.py":1892
 *         return hash(("Expression", self._head) + tuple(self._leaves))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         update(("%s>%d>" % (self.get_head_name(), len(self._leaves))).encode("utf8"))
 *         for leaf in self._leaves:
 */
  __pyx_tuple__420 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_update, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__420)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__420);
  __Pyx_GIVEREF(__pyx_tuple__420);
  __pyx_codeobj__421 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__420, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_user_hash, 1892, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__421)) __PYX_ERR(0, 1892, __pyx_L1_error)

  /* "mathics/core/expression.py":1897
 *             leaf.user_hash(update)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self._head, self._leaves)
 * 
 */
  __pyx_tuple__422 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__422)) __PYX_ERR(0, 1897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__422);
  __Pyx_GIVEREF(__pyx_tuple__422);
  __pyx_codeobj__423 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__422, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_getnewargs, 1897, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__423)) __PYX_ERR(0, 1897, __pyx_L1_error)

  /* "mathics/core/expression.py":1902
 * 
 * class Atom(BaseExpression):
 *     def is_atom(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_tuple__424 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__424)) __PYX_ERR(0, 1902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__424);
  __Pyx_GIVEREF(__pyx_tuple__424);
  __pyx_codeobj__425 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__424, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_atom, 1902, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__425)) __PYX_ERR(0, 1902, __pyx_L1_error)

  /* "mathics/core/expression.py":1905
 *         return True
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */
  __pyx_tuple__426 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rhs); if (unlikely(!__pyx_tuple__426)) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__426);
  __Pyx_GIVEREF(__pyx_tuple__426);
  __pyx_codeobj__427 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__426, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_equal2, 1905, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__427)) __PYX_ERR(0, 1905, __pyx_L1_error)

  /* "mathics/core/expression.py":1915
 *         return self == rhs
 * 
 *     def has_form(self, heads, *leaf_counts) -> bool:             # <<<<<<<<<<<<<<
 *         if leaf_counts:
 *             return False
 */
  __pyx_tuple__428 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_heads, __pyx_n_s_leaf_counts, __pyx_n_s_name); if (unlikely(!__pyx_tuple__428)) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__428);
  __Pyx_GIVEREF(__pyx_tuple__428);
  __pyx_codeobj__429 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__428, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_has_form, 1915, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__429)) __PYX_ERR(0, 1915, __pyx_L1_error)

  /* "mathics/core/expression.py":1924
 *             return heads == name
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_tuple__430 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_symbol_name); if (unlikely(!__pyx_tuple__430)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__430);
  __Pyx_GIVEREF(__pyx_tuple__430);
  __pyx_codeobj__431 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__430, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_has_symbol, 1924, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__431)) __PYX_ERR(0, 1924, __pyx_L1_error)

  /* "mathics/core/expression.py":1927
 *         return False
 * 
 *     def get_head(self) -> "Symbol":             # <<<<<<<<<<<<<<
 *         return Symbol(self.get_atom_name())
 * 
 */
  __pyx_tuple__432 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__432)) __PYX_ERR(0, 1927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__432);
  __Pyx_GIVEREF(__pyx_tuple__432);
  __pyx_codeobj__433 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__432, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_head, 1927, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__433)) __PYX_ERR(0, 1927, __pyx_L1_error)

  /* "mathics/core/expression.py":1930
 *         return Symbol(self.get_atom_name())
 * 
 *     def get_atom_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.__class__.__name__
 * 
 */
  __pyx_tuple__434 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__434)) __PYX_ERR(0, 1930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__434);
  __Pyx_GIVEREF(__pyx_tuple__434);
  __pyx_codeobj__435 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__434, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_atom_name, 1930, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__435)) __PYX_ERR(0, 1930, __pyx_L1_error)

  /* "mathics/core/expression.py":1933
 *         return self.__class__.__name__
 * 
 *     def __repr__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "<%s: %s>" % (self.get_atom_name(), self)
 * 
 */
  __pyx_tuple__436 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__436)) __PYX_ERR(0, 1933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__436);
  __Pyx_GIVEREF(__pyx_tuple__436);
  __pyx_codeobj__437 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__436, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_repr, 1933, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__437)) __PYX_ERR(0, 1933, __pyx_L1_error)

  /* "mathics/core/expression.py":1936
 *         return "<%s: %s>" % (self.get_atom_name(), self)
 * 
 *     def replace_vars(self, vars, options=None, in_scoping=True) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__438 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_vars, __pyx_n_s_options, __pyx_n_s_in_scoping); if (unlikely(!__pyx_tuple__438)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__438);
  __Pyx_GIVEREF(__pyx_tuple__438);
  __pyx_codeobj__439 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__438, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_replace_vars, 1936, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__439)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __pyx_tuple__440 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__440)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__440);
  __Pyx_GIVEREF(__pyx_tuple__440);

  /* "mathics/core/expression.py":1939
 *         return self
 * 
 *     def replace_slots(self, slots, evaluation) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__441 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_slots, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__441)) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__441);
  __Pyx_GIVEREF(__pyx_tuple__441);
  __pyx_codeobj__442 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__441, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_replace_slots, 1939, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__442)) __PYX_ERR(0, 1939, __pyx_L1_error)

  /* "mathics/core/expression.py":1942
 *         return self
 * 
 *     def numerify(self, evaluation) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__443 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__443)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__443);
  __Pyx_GIVEREF(__pyx_tuple__443);
  __pyx_codeobj__444 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__443, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_numerify, 1942, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__444)) __PYX_ERR(0, 1942, __pyx_L1_error)

  /* "mathics/core/expression.py":1945
 *         return self
 * 
 *     def copy(self, reevaluate=False) -> "Atom":             # <<<<<<<<<<<<<<
 *         result = self.do_copy()
 *         result.original = self
 */
  __pyx_tuple__445 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_reevaluate, __pyx_n_s_result); if (unlikely(!__pyx_tuple__445)) __PYX_ERR(0, 1945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__445);
  __Pyx_GIVEREF(__pyx_tuple__445);
  __pyx_codeobj__446 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__445, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_copy, 1945, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__446)) __PYX_ERR(0, 1945, __pyx_L1_error)
  __pyx_tuple__447 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__447)) __PYX_ERR(0, 1945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__447);
  __Pyx_GIVEREF(__pyx_tuple__447);

  /* "mathics/core/expression.py":1950
 *         return result
 * 
 *     def set_positions(self, position=None) -> None:             # <<<<<<<<<<<<<<
 *         self.position = position
 * 
 */
  __pyx_tuple__448 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_position); if (unlikely(!__pyx_tuple__448)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__448);
  __Pyx_GIVEREF(__pyx_tuple__448);
  __pyx_codeobj__449 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__448, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_set_positions, 1950, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__449)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __pyx_tuple__450 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__450)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__450);
  __Pyx_GIVEREF(__pyx_tuple__450);

  /* "mathics/core/expression.py":1953
 *         self.position = position
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return [0, 0, 1, 1, 0, 0, 0, 1]
 */
  __pyx_tuple__451 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pattern_sort); if (unlikely(!__pyx_tuple__451)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__451);
  __Pyx_GIVEREF(__pyx_tuple__451);
  __pyx_codeobj__452 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__451, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sort_key, 1953, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__452)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __pyx_tuple__453 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__453)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__453);
  __Pyx_GIVEREF(__pyx_tuple__453);

  /* "mathics/core/expression.py":1959
 *             raise NotImplementedError
 * 
 *     def get_atoms(self, include_heads=True) -> typing.List["Atom"]:             # <<<<<<<<<<<<<<
 *         return [self]
 * 
 */
  __pyx_tuple__454 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_include_heads); if (unlikely(!__pyx_tuple__454)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__454);
  __Pyx_GIVEREF(__pyx_tuple__454);
  __pyx_codeobj__455 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__454, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_atoms, 1959, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__455)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __pyx_tuple__456 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__456)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__456);
  __Pyx_GIVEREF(__pyx_tuple__456);

  /* "mathics/core/expression.py":1962
 *         return [self]
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  __pyx_tuple__457 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_f, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__457)) __PYX_ERR(0, 1962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__457);
  __Pyx_GIVEREF(__pyx_tuple__457);
  __pyx_codeobj__458 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__457, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_atom_to_boxes, 1962, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__458)) __PYX_ERR(0, 1962, __pyx_L1_error)

  /* "mathics/core/expression.py":1971
 *     defined_symbols = {}
 * 
 *     def __new__(cls, name, sympy_dummy=None):             # <<<<<<<<<<<<<<
 *         name = ensure_context(name)
 *         self = cls.defined_symbols.get(name, None)
 */
  __pyx_tuple__459 = PyTuple_Pack(4, __pyx_n_s_cls, __pyx_n_s_name, __pyx_n_s_sympy_dummy, __pyx_n_s_self); if (unlikely(!__pyx_tuple__459)) __PYX_ERR(0, 1971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__459);
  __Pyx_GIVEREF(__pyx_tuple__459);
  __pyx_codeobj__460 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__459, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 1971, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__460)) __PYX_ERR(0, 1971, __pyx_L1_error)
  __pyx_tuple__461 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__461)) __PYX_ERR(0, 1971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__461);
  __Pyx_GIVEREF(__pyx_tuple__461);

  /* "mathics/core/expression.py":1981
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */
  __pyx_tuple__462 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__462)) __PYX_ERR(0, 1981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__462);
  __Pyx_GIVEREF(__pyx_tuple__462);
  __pyx_codeobj__463 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__462, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_str, 1981, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__463)) __PYX_ERR(0, 1981, __pyx_L1_error)

  /* "mathics/core/expression.py":1984
 *         return self.name
 * 
 *     def do_copy(self) -> "Symbol":             # <<<<<<<<<<<<<<
 *         return Symbol(self.name)
 * 
 */
  __pyx_tuple__464 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__464)) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__464);
  __Pyx_GIVEREF(__pyx_tuple__464);
  __pyx_codeobj__465 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__464, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_copy, 1984, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__465)) __PYX_ERR(0, 1984, __pyx_L1_error)

  /* "mathics/core/expression.py":1987
 *         return Symbol(self.name)
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.name)
 * 
 */
  __pyx_tuple__466 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_options); if (unlikely(!__pyx_tuple__466)) __PYX_ERR(0, 1987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__466);
  __Pyx_GIVEREF(__pyx_tuple__466);
  __pyx_codeobj__467 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__466, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_text, 1987, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__467)) __PYX_ERR(0, 1987, __pyx_L1_error)

  /* "mathics/core/expression.py":1990
 *         return str(self.name)
 * 
 *     def atom_to_boxes(self, f, evaluation) -> "String":             # <<<<<<<<<<<<<<
 *         return String(evaluation.definitions.shorten_name(self.name))
 * 
 */
  __pyx_tuple__468 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_f, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__468)) __PYX_ERR(0, 1990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__468);
  __Pyx_GIVEREF(__pyx_tuple__468);
  __pyx_codeobj__469 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__468, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_atom_to_boxes, 1990, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__469)) __PYX_ERR(0, 1990, __pyx_L1_error)

  /* "mathics/core/expression.py":1993
 *         return String(evaluation.definitions.shorten_name(self.name))
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         from mathics.builtin import mathics_to_sympy
 * 
 */
  __pyx_tuple__470 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_kwargs, __pyx_n_s_mathics_to_sympy, __pyx_n_s_builtin); if (unlikely(!__pyx_tuple__470)) __PYX_ERR(0, 1993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__470);
  __Pyx_GIVEREF(__pyx_tuple__470);
  __pyx_codeobj__471 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__470, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_sympy, 1993, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__471)) __PYX_ERR(0, 1993, __pyx_L1_error)

  /* "mathics/core/expression.py":2008
 *         return builtin.to_sympy(self, **kwargs)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         if self == SymbolTrue:
 *             return True
 */
  __pyx_tuple__472 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_n_evaluation, __pyx_n_s_value); if (unlikely(!__pyx_tuple__472)) __PYX_ERR(0, 2008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__472);
  __Pyx_GIVEREF(__pyx_tuple__472);
  __pyx_codeobj__473 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__472, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_python, 2008, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__473)) __PYX_ERR(0, 2008, __pyx_L1_error)

  /* "mathics/core/expression.py":2025
 *             return self.name
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */
  __pyx_tuple__474 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form); if (unlikely(!__pyx_tuple__474)) __PYX_ERR(0, 2025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__474);
  __Pyx_GIVEREF(__pyx_tuple__474);
  __pyx_codeobj__475 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__474, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_default_format, 2025, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__475)) __PYX_ERR(0, 2025, __pyx_L1_error)

  /* "mathics/core/expression.py":2028
 *         return self.name
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         return definitions.get_attributes(self.name)
 * 
 */
  __pyx_tuple__476 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_definitions); if (unlikely(!__pyx_tuple__476)) __PYX_ERR(0, 2028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__476);
  __Pyx_GIVEREF(__pyx_tuple__476);
  __pyx_codeobj__477 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__476, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_attributes, 2028, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__477)) __PYX_ERR(0, 2028, __pyx_L1_error)

  /* "mathics/core/expression.py":2031
 *         return definitions.get_attributes(self.name)
 * 
 *     def get_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */
  __pyx_tuple__478 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__478)) __PYX_ERR(0, 2031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__478);
  __Pyx_GIVEREF(__pyx_tuple__478);
  __pyx_codeobj__479 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__478, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_name, 2031, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__479)) __PYX_ERR(0, 2031, __pyx_L1_error)

  /* "mathics/core/expression.py":2034
 *         return self.name
 * 
 *     def is_symbol(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_tuple__480 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__480)) __PYX_ERR(0, 2034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__480);
  __Pyx_GIVEREF(__pyx_tuple__480);
  __pyx_codeobj__481 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__480, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_symbol, 2034, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__481)) __PYX_ERR(0, 2034, __pyx_L1_error)

  /* "mathics/core/expression.py":2037
 *         return True
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super(Symbol, self).get_sort_key(True)
 */
  __pyx_tuple__482 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pattern_sort); if (unlikely(!__pyx_tuple__482)) __PYX_ERR(0, 2037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__482);
  __Pyx_GIVEREF(__pyx_tuple__482);
  __pyx_codeobj__483 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__482, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sort_key, 2037, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__483)) __PYX_ERR(0, 2037, __pyx_L1_error)
  __pyx_tuple__484 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__484)) __PYX_ERR(0, 2037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__484);
  __Pyx_GIVEREF(__pyx_tuple__484);

  /* "mathics/core/expression.py":2050
 *             ]
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)"""
 *         if self.sameQ(rhs):
 */
  __pyx_tuple__485 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rhs); if (unlikely(!__pyx_tuple__485)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__485);
  __Pyx_GIVEREF(__pyx_tuple__485);
  __pyx_codeobj__486 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__485, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_equal2, 2050, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__486)) __PYX_ERR(0, 2050, __pyx_L1_error)

  /* "mathics/core/expression.py":2063
 *         return None
 * 
 *     def sameQ(self, rhs: Any) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name
 */
  __pyx_tuple__487 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_rhs); if (unlikely(!__pyx_tuple__487)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__487);
  __Pyx_GIVEREF(__pyx_tuple__487);
  __pyx_codeobj__488 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__487, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sameQ, 2063, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__488)) __PYX_ERR(0, 2063, __pyx_L1_error)

  /* "mathics/core/expression.py":2067
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name
 * 
 *     def replace_vars(self, vars, options={}, in_scoping=True):             # <<<<<<<<<<<<<<
 *         assert all(fully_qualified_symbol_name(v) for v in vars)
 *         var = vars.get(self.name, None)
 */
  __pyx_tuple__489 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_vars, __pyx_n_s_options, __pyx_n_s_in_scoping, __pyx_n_s_var, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__489)) __PYX_ERR(0, 2067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__489);
  __Pyx_GIVEREF(__pyx_tuple__489);
  __pyx_codeobj__490 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__489, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_replace_vars, 2067, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__490)) __PYX_ERR(0, 2067, __pyx_L1_error)

  /* "mathics/core/expression.py":2075
 *             return var
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         return self.name == ensure_context(symbol_name)
 * 
 */
  __pyx_tuple__491 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_symbol_name); if (unlikely(!__pyx_tuple__491)) __PYX_ERR(0, 2075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__491);
  __Pyx_GIVEREF(__pyx_tuple__491);
  __pyx_codeobj__492 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__491, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_has_symbol, 2075, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__492)) __PYX_ERR(0, 2075, __pyx_L1_error)

  /* "mathics/core/expression.py":2078
 *         return self.name == ensure_context(symbol_name)
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         rules = evaluation.definitions.get_ownvalues(self.name)
 *         for rule in rules:
 */
  __pyx_tuple__493 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_rules, __pyx_n_s_rule, __pyx_n_s_result); if (unlikely(!__pyx_tuple__493)) __PYX_ERR(0, 2078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__493);
  __Pyx_GIVEREF(__pyx_tuple__493);
  __pyx_codeobj__494 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__493, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate, 2078, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__494)) __PYX_ERR(0, 2078, __pyx_L1_error)

  /* "mathics/core/expression.py":2086
 *         return self
 * 
 *     def is_true(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self == SymbolTrue
 * 
 */
  __pyx_tuple__495 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__495)) __PYX_ERR(0, 2086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__495);
  __Pyx_GIVEREF(__pyx_tuple__495);
  __pyx_codeobj__496 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__495, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_true, 2086, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__496)) __PYX_ERR(0, 2086, __pyx_L1_error)

  /* "mathics/core/expression.py":2089
 *         return self == SymbolTrue
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.name in system_symbols(
 *             "Pi", "E", "EulerGamma", "GoldenRatio", "MachinePrecision", "Catalan"
 */
  __pyx_tuple__497 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__497)) __PYX_ERR(0, 2089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__497);
  __Pyx_GIVEREF(__pyx_tuple__497);
  __pyx_codeobj__498 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__497, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_numeric, 2089, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__498)) __PYX_ERR(0, 2089, __pyx_L1_error)

  /* "mathics/core/expression.py":2094
 *         )
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Symbol", self.name))  # to distinguish from String
 * 
 */
  __pyx_tuple__499 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__499)) __PYX_ERR(0, 2094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__499);
  __Pyx_GIVEREF(__pyx_tuple__499);
  __pyx_codeobj__500 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__499, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_hash, 2094, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__500)) __PYX_ERR(0, 2094, __pyx_L1_error)

  /* "mathics/core/expression.py":2097
 *         return hash(("Symbol", self.name))  # to distinguish from String
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(b"System`Symbol>" + self.name.encode("utf8"))
 * 
 */
  __pyx_tuple__501 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_update); if (unlikely(!__pyx_tuple__501)) __PYX_ERR(0, 2097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__501);
  __Pyx_GIVEREF(__pyx_tuple__501);
  __pyx_codeobj__502 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__501, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_user_hash, 2097, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__502)) __PYX_ERR(0, 2097, __pyx_L1_error)

  /* "mathics/core/expression.py":2100
 *         update(b"System`Symbol>" + self.name.encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.name, self.sympy_dummy)
 * 
 */
  __pyx_tuple__503 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__503)) __PYX_ERR(0, 2100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__503);
  __Pyx_GIVEREF(__pyx_tuple__503);
  __pyx_codeobj__504 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__503, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_getnewargs, 2100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__504)) __PYX_ERR(0, 2100, __pyx_L1_error)

  /* "mathics/core/expression.py":2105
 * 
 * # Some common Symbols. This list is sorted in alpabetic order.
 * SymbolAborted = Symbol("$Aborted")             # <<<<<<<<<<<<<<
 * SymbolAssociation = Symbol("Association")
 * SymbolByteArray = Symbol("ByteArray")
 */
  __pyx_tuple__505 = PyTuple_Pack(1, __pyx_kp_u_Aborted); if (unlikely(!__pyx_tuple__505)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__505);
  __Pyx_GIVEREF(__pyx_tuple__505);

  /* "mathics/core/expression.py":2106
 * # Some common Symbols. This list is sorted in alpabetic order.
 * SymbolAborted = Symbol("$Aborted")
 * SymbolAssociation = Symbol("Association")             # <<<<<<<<<<<<<<
 * SymbolByteArray = Symbol("ByteArray")
 * SymbolComplexInfinity = Symbol("ComplexInfinity")
 */
  __pyx_tuple__506 = PyTuple_Pack(1, __pyx_n_u_Association); if (unlikely(!__pyx_tuple__506)) __PYX_ERR(0, 2106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__506);
  __Pyx_GIVEREF(__pyx_tuple__506);

  /* "mathics/core/expression.py":2107
 * SymbolAborted = Symbol("$Aborted")
 * SymbolAssociation = Symbol("Association")
 * SymbolByteArray = Symbol("ByteArray")             # <<<<<<<<<<<<<<
 * SymbolComplexInfinity = Symbol("ComplexInfinity")
 * SymbolDirectedInfinity = Symbol("DirectedInfinity")
 */
  __pyx_tuple__507 = PyTuple_Pack(1, __pyx_n_u_ByteArray); if (unlikely(!__pyx_tuple__507)) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__507);
  __Pyx_GIVEREF(__pyx_tuple__507);

  /* "mathics/core/expression.py":2108
 * SymbolAssociation = Symbol("Association")
 * SymbolByteArray = Symbol("ByteArray")
 * SymbolComplexInfinity = Symbol("ComplexInfinity")             # <<<<<<<<<<<<<<
 * SymbolDirectedInfinity = Symbol("DirectedInfinity")
 * SymbolFailed = Symbol("$Failed")
 */
  __pyx_tuple__508 = PyTuple_Pack(1, __pyx_n_u_ComplexInfinity); if (unlikely(!__pyx_tuple__508)) __PYX_ERR(0, 2108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__508);
  __Pyx_GIVEREF(__pyx_tuple__508);

  /* "mathics/core/expression.py":2109
 * SymbolByteArray = Symbol("ByteArray")
 * SymbolComplexInfinity = Symbol("ComplexInfinity")
 * SymbolDirectedInfinity = Symbol("DirectedInfinity")             # <<<<<<<<<<<<<<
 * SymbolFailed = Symbol("$Failed")
 * SymbolFalse = Symbol("False")
 */
  __pyx_tuple__509 = PyTuple_Pack(1, __pyx_n_u_DirectedInfinity); if (unlikely(!__pyx_tuple__509)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__509);
  __Pyx_GIVEREF(__pyx_tuple__509);

  /* "mathics/core/expression.py":2110
 * SymbolComplexInfinity = Symbol("ComplexInfinity")
 * SymbolDirectedInfinity = Symbol("DirectedInfinity")
 * SymbolFailed = Symbol("$Failed")             # <<<<<<<<<<<<<<
 * SymbolFalse = Symbol("False")
 * SymbolInfinity = Symbol("Infinity")
 */
  __pyx_tuple__510 = PyTuple_Pack(1, __pyx_kp_u_Failed); if (unlikely(!__pyx_tuple__510)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__510);
  __Pyx_GIVEREF(__pyx_tuple__510);

  /* "mathics/core/expression.py":2111
 * SymbolDirectedInfinity = Symbol("DirectedInfinity")
 * SymbolFailed = Symbol("$Failed")
 * SymbolFalse = Symbol("False")             # <<<<<<<<<<<<<<
 * SymbolInfinity = Symbol("Infinity")
 * SymbolList = Symbol("List")
 */
  __pyx_tuple__511 = PyTuple_Pack(1, __pyx_n_u_False); if (unlikely(!__pyx_tuple__511)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__511);
  __Pyx_GIVEREF(__pyx_tuple__511);

  /* "mathics/core/expression.py":2112
 * SymbolFailed = Symbol("$Failed")
 * SymbolFalse = Symbol("False")
 * SymbolInfinity = Symbol("Infinity")             # <<<<<<<<<<<<<<
 * SymbolList = Symbol("List")
 * SymbolMakeBoxes = Symbol("MakeBoxes")
 */
  __pyx_tuple__512 = PyTuple_Pack(1, __pyx_n_u_Infinity); if (unlikely(!__pyx_tuple__512)) __PYX_ERR(0, 2112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__512);
  __Pyx_GIVEREF(__pyx_tuple__512);

  /* "mathics/core/expression.py":2113
 * SymbolFalse = Symbol("False")
 * SymbolInfinity = Symbol("Infinity")
 * SymbolList = Symbol("List")             # <<<<<<<<<<<<<<
 * SymbolMakeBoxes = Symbol("MakeBoxes")
 * SymbolN = Symbol("N")
 */
  __pyx_tuple__513 = PyTuple_Pack(1, __pyx_n_u_List); if (unlikely(!__pyx_tuple__513)) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__513);
  __Pyx_GIVEREF(__pyx_tuple__513);

  /* "mathics/core/expression.py":2114
 * SymbolInfinity = Symbol("Infinity")
 * SymbolList = Symbol("List")
 * SymbolMakeBoxes = Symbol("MakeBoxes")             # <<<<<<<<<<<<<<
 * SymbolN = Symbol("N")
 * SymbolNull = Symbol("Null")
 */
  __pyx_tuple__514 = PyTuple_Pack(1, __pyx_n_u_MakeBoxes); if (unlikely(!__pyx_tuple__514)) __PYX_ERR(0, 2114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__514);
  __Pyx_GIVEREF(__pyx_tuple__514);

  /* "mathics/core/expression.py":2115
 * SymbolList = Symbol("List")
 * SymbolMakeBoxes = Symbol("MakeBoxes")
 * SymbolN = Symbol("N")             # <<<<<<<<<<<<<<
 * SymbolNull = Symbol("Null")
 * SymbolRule = Symbol("Rule")
 */
  __pyx_tuple__515 = PyTuple_Pack(1, __pyx_n_u_N); if (unlikely(!__pyx_tuple__515)) __PYX_ERR(0, 2115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__515);
  __Pyx_GIVEREF(__pyx_tuple__515);

  /* "mathics/core/expression.py":2116
 * SymbolMakeBoxes = Symbol("MakeBoxes")
 * SymbolN = Symbol("N")
 * SymbolNull = Symbol("Null")             # <<<<<<<<<<<<<<
 * SymbolRule = Symbol("Rule")
 * SymbolSequence = Symbol("Sequence")
 */
  __pyx_tuple__516 = PyTuple_Pack(1, __pyx_n_u_Null); if (unlikely(!__pyx_tuple__516)) __PYX_ERR(0, 2116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__516);
  __Pyx_GIVEREF(__pyx_tuple__516);

  /* "mathics/core/expression.py":2117
 * SymbolN = Symbol("N")
 * SymbolNull = Symbol("Null")
 * SymbolRule = Symbol("Rule")             # <<<<<<<<<<<<<<
 * SymbolSequence = Symbol("Sequence")
 * SymbolTrue = Symbol("True")
 */
  __pyx_tuple__517 = PyTuple_Pack(1, __pyx_n_u_Rule); if (unlikely(!__pyx_tuple__517)) __PYX_ERR(0, 2117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__517);
  __Pyx_GIVEREF(__pyx_tuple__517);

  /* "mathics/core/expression.py":2118
 * SymbolNull = Symbol("Null")
 * SymbolRule = Symbol("Rule")
 * SymbolSequence = Symbol("Sequence")             # <<<<<<<<<<<<<<
 * SymbolTrue = Symbol("True")
 * SymbolUndefined = Symbol("Undefined")
 */
  __pyx_tuple__518 = PyTuple_Pack(1, __pyx_n_u_Sequence); if (unlikely(!__pyx_tuple__518)) __PYX_ERR(0, 2118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__518);
  __Pyx_GIVEREF(__pyx_tuple__518);

  /* "mathics/core/expression.py":2119
 * SymbolRule = Symbol("Rule")
 * SymbolSequence = Symbol("Sequence")
 * SymbolTrue = Symbol("True")             # <<<<<<<<<<<<<<
 * SymbolUndefined = Symbol("Undefined")
 * 
 */
  __pyx_tuple__519 = PyTuple_Pack(1, __pyx_n_u_True); if (unlikely(!__pyx_tuple__519)) __PYX_ERR(0, 2119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__519);
  __Pyx_GIVEREF(__pyx_tuple__519);

  /* "mathics/core/expression.py":2120
 * SymbolSequence = Symbol("Sequence")
 * SymbolTrue = Symbol("True")
 * SymbolUndefined = Symbol("Undefined")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__520 = PyTuple_Pack(1, __pyx_n_u_Undefined); if (unlikely(!__pyx_tuple__520)) __PYX_ERR(0, 2120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__520);
  __Pyx_GIVEREF(__pyx_tuple__520);

  /* "mathics/core/expression.py":2124
 * 
 * @lru_cache(maxsize=1024)
 * def from_mpmath(value, prec=None):             # <<<<<<<<<<<<<<
 *     "Converts mpf or mpc to Number."
 *     if isinstance(value, mpmath.mpf):
 */
  __pyx_tuple__521 = PyTuple_Pack(4, __pyx_n_s_value, __pyx_n_s_prec, __pyx_n_s_real, __pyx_n_s_imag); if (unlikely(!__pyx_tuple__521)) __PYX_ERR(0, 2124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__521);
  __Pyx_GIVEREF(__pyx_tuple__521);
  __pyx_codeobj__522 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__521, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_from_mpmath, 2124, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__522)) __PYX_ERR(0, 2124, __pyx_L1_error)
  __pyx_tuple__523 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__523)) __PYX_ERR(0, 2124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__523);
  __Pyx_GIVEREF(__pyx_tuple__523);

  /* "mathics/core/expression.py":2143
 * 
 * class Number(Atom):
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */
  __pyx_tuple__524 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__524)) __PYX_ERR(0, 2143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__524);
  __Pyx_GIVEREF(__pyx_tuple__524);
  __pyx_codeobj__525 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__524, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_str, 2143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__525)) __PYX_ERR(0, 2143, __pyx_L1_error)

  /* "mathics/core/expression.py":2146
 *         return str(self.value)
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_tuple__526 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__526)) __PYX_ERR(0, 2146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__526);
  __Pyx_GIVEREF(__pyx_tuple__526);
  __pyx_codeobj__527 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__526, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_numeric, 2146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__527)) __PYX_ERR(0, 2146, __pyx_L1_error)

  /* "mathics/core/expression.py":2150
 * 
 * 
 * def _ExponentFunction(value):             # <<<<<<<<<<<<<<
 *     n = value.get_int_value()
 *     if -5 <= n <= 5:
 */
  __pyx_tuple__528 = PyTuple_Pack(2, __pyx_n_s_value, __pyx_n_s_n); if (unlikely(!__pyx_tuple__528)) __PYX_ERR(0, 2150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__528);
  __Pyx_GIVEREF(__pyx_tuple__528);
  __pyx_codeobj__529 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__528, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_ExponentFunction, 2150, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__529)) __PYX_ERR(0, 2150, __pyx_L1_error)

  /* "mathics/core/expression.py":2158
 * 
 * 
 * def _NumberFormat(man, base, exp, options):             # <<<<<<<<<<<<<<
 *     if exp.get_string_value():
 *         if options["_Form"] in (
 */
  __pyx_tuple__530 = PyTuple_Pack(4, __pyx_n_s_man, __pyx_n_s_base, __pyx_n_s_exp, __pyx_n_s_options); if (unlikely(!__pyx_tuple__530)) __PYX_ERR(0, 2158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__530);
  __Pyx_GIVEREF(__pyx_tuple__530);
  __pyx_codeobj__531 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__530, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_NumberFormat, 2158, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__531)) __PYX_ERR(0, 2158, __pyx_L1_error)

  /* "mathics/core/expression.py":2196
 *     value: int
 * 
 *     def __new__(cls, value) -> "Integer":             # <<<<<<<<<<<<<<
 *         n = int(value)
 *         self = super(Integer, cls).__new__(cls)
 */
  __pyx_tuple__533 = PyTuple_Pack(4, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_n, __pyx_n_s_self); if (unlikely(!__pyx_tuple__533)) __PYX_ERR(0, 2196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__533);
  __Pyx_GIVEREF(__pyx_tuple__533);
  __pyx_codeobj__534 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__533, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 2196, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__534)) __PYX_ERR(0, 2196, __pyx_L1_error)

  /* "mathics/core/expression.py":2203
 * 
 *     @lru_cache()
 *     def __init__(self, value) -> "Integer":             # <<<<<<<<<<<<<<
 *         super().__init__()
 * 
 */
  __pyx_tuple__535 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__535)) __PYX_ERR(0, 2203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__535);
  __Pyx_GIVEREF(__pyx_tuple__535);
  __pyx_codeobj__536 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__535, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_init, 2203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__536)) __PYX_ERR(0, 2203, __pyx_L1_error)

  /* "mathics/core/expression.py":2206
 *         super().__init__()
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */
  __pyx_tuple__537 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_options); if (unlikely(!__pyx_tuple__537)) __PYX_ERR(0, 2206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__537);
  __Pyx_GIVEREF(__pyx_tuple__537);
  __pyx_codeobj__538 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__537, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_text, 2206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__538)) __PYX_ERR(0, 2206, __pyx_L1_error)

  /* "mathics/core/expression.py":2209
 *         return str(self.value)
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("MathMLForm").boxes_to_mathml(**options)
 * 
 */
  __pyx_tuple__539 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_options); if (unlikely(!__pyx_tuple__539)) __PYX_ERR(0, 2209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__539);
  __Pyx_GIVEREF(__pyx_tuple__539);
  __pyx_codeobj__540 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__539, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_mathml, 2209, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__540)) __PYX_ERR(0, 2209, __pyx_L1_error)

  /* "mathics/core/expression.py":2212
 *         return self.make_boxes("MathMLForm").boxes_to_mathml(**options)
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */
  __pyx_tuple__541 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_options); if (unlikely(!__pyx_tuple__541)) __PYX_ERR(0, 2212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__541);
  __Pyx_GIVEREF(__pyx_tuple__541);
  __pyx_codeobj__542 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__541, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_tex, 2212, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__542)) __PYX_ERR(0, 2212, __pyx_L1_error)

  /* "mathics/core/expression.py":2215
 *         return str(self.value)
 * 
 *     def make_boxes(self, form) -> "String":             # <<<<<<<<<<<<<<
 *         return String(str(self.value))
 * 
 */
  __pyx_tuple__543 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_form); if (unlikely(!__pyx_tuple__543)) __PYX_ERR(0, 2215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__543);
  __Pyx_GIVEREF(__pyx_tuple__543);
  __pyx_codeobj__544 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__543, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_make_boxes, 2215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__544)) __PYX_ERR(0, 2215, __pyx_L1_error)

  /* "mathics/core/expression.py":2218
 *         return String(str(self.value))
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.make_boxes(f.get_name())
 * 
 */
  __pyx_tuple__545 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_f, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__545)) __PYX_ERR(0, 2218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__545);
  __Pyx_GIVEREF(__pyx_tuple__545);
  __pyx_codeobj__546 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__545, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_atom_to_boxes, 2218, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__546)) __PYX_ERR(0, 2218, __pyx_L1_error)

  /* "mathics/core/expression.py":2221
 *         return self.make_boxes(f.get_name())
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */
  __pyx_tuple__547 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form); if (unlikely(!__pyx_tuple__547)) __PYX_ERR(0, 2221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__547);
  __Pyx_GIVEREF(__pyx_tuple__547);
  __pyx_codeobj__548 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__547, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_default_format, 2221, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__548)) __PYX_ERR(0, 2221, __pyx_L1_error)

  /* "mathics/core/expression.py":2224
 *         return str(self.value)
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return sympy.Integer(self.value)
 * 
 */
  __pyx_tuple__549 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__549)) __PYX_ERR(0, 2224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__549);
  __Pyx_GIVEREF(__pyx_tuple__549);
  __pyx_codeobj__550 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__549, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_sympy, 2224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__550)) __PYX_ERR(0, 2224, __pyx_L1_error)

  /* "mathics/core/expression.py":2227
 *         return sympy.Integer(self.value)
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */
  __pyx_tuple__551 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__551)) __PYX_ERR(0, 2227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__551);
  __Pyx_GIVEREF(__pyx_tuple__551);
  __pyx_codeobj__552 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__551, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_mpmath, 2227, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__552)) __PYX_ERR(0, 2227, __pyx_L1_error)

  /* "mathics/core/expression.py":2230
 *         return mpmath.mpf(self.value)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_tuple__553 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__553)) __PYX_ERR(0, 2230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__553);
  __Pyx_GIVEREF(__pyx_tuple__553);
  __pyx_codeobj__554 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__553, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_python, 2230, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__554)) __PYX_ERR(0, 2230, __pyx_L1_error)

  /* "mathics/core/expression.py":2233
 *         return self.value
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */
  __pyx_tuple__555 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_d); if (unlikely(!__pyx_tuple__555)) __PYX_ERR(0, 2233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__555);
  __Pyx_GIVEREF(__pyx_tuple__555);
  __pyx_codeobj__556 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__555, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_round, 2233, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__556)) __PYX_ERR(0, 2233, __pyx_L1_error)
  __pyx_tuple__557 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__557)) __PYX_ERR(0, 2233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__557);
  __Pyx_GIVEREF(__pyx_tuple__557);
  __pyx_tuple__558 = PyTuple_Pack(2, __pyx_n_u_MachineReal, __pyx_n_u_PrecisionReal); if (unlikely(!__pyx_tuple__558)) __PYX_ERR(0, 2233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__558);
  __Pyx_GIVEREF(__pyx_tuple__558);

  /* "mathics/core/expression.py":2239
 *             return PrecisionReal(sympy.Float(self.value, d))
 * 
 *     def get_int_value(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_tuple__559 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__559)) __PYX_ERR(0, 2239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__559);
  __Pyx_GIVEREF(__pyx_tuple__559);
  __pyx_codeobj__560 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__559, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_int_value, 2239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__560)) __PYX_ERR(0, 2239, __pyx_L1_error)

  /* "mathics/core/expression.py":2242
 *         return self.value
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, Integer) and self.value == other.value
 */
  __pyx_tuple__561 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__561)) __PYX_ERR(0, 2242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__561);
  __Pyx_GIVEREF(__pyx_tuple__561);
  __pyx_codeobj__562 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__561, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sameQ, 2242, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__562)) __PYX_ERR(0, 2242, __pyx_L1_error)

  /* "mathics/core/expression.py":2246
 *         return isinstance(other, Integer) and self.value == other.value
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */
  __pyx_tuple__563 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__563)) __PYX_ERR(0, 2246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__563);
  __Pyx_GIVEREF(__pyx_tuple__563);
  __pyx_codeobj__564 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__563, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate, 2246, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__564)) __PYX_ERR(0, 2246, __pyx_L1_error)

  /* "mathics/core/expression.py":2250
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_tuple__565 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pattern_sort); if (unlikely(!__pyx_tuple__565)) __PYX_ERR(0, 2250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__565);
  __Pyx_GIVEREF(__pyx_tuple__565);
  __pyx_codeobj__566 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__565, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sort_key, 2250, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__566)) __PYX_ERR(0, 2250, __pyx_L1_error)
  __pyx_tuple__567 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__567)) __PYX_ERR(0, 2250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__567);
  __Pyx_GIVEREF(__pyx_tuple__567);

  /* "mathics/core/expression.py":2256
 *             return [0, 0, self.value, 0, 1]
 * 
 *     def do_copy(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value)
 * 
 */
  __pyx_tuple__568 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__568)) __PYX_ERR(0, 2256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__568);
  __Pyx_GIVEREF(__pyx_tuple__568);
  __pyx_codeobj__569 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__568, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_copy, 2256, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__569)) __PYX_ERR(0, 2256, __pyx_L1_error)

  /* "mathics/core/expression.py":2259
 *         return Integer(self.value)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Integer", self.value))
 * 
 */
  __pyx_tuple__570 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__570)) __PYX_ERR(0, 2259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__570);
  __Pyx_GIVEREF(__pyx_tuple__570);
  __pyx_codeobj__571 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__570, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_hash, 2259, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__571)) __PYX_ERR(0, 2259, __pyx_L1_error)

  /* "mathics/core/expression.py":2262
 *         return hash(("Integer", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         update(b"System`Integer>" + str(self.value).encode("utf8"))
 * 
 */
  __pyx_tuple__572 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_update); if (unlikely(!__pyx_tuple__572)) __PYX_ERR(0, 2262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__572);
  __Pyx_GIVEREF(__pyx_tuple__572);
  __pyx_codeobj__573 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__572, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_user_hash, 2262, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__573)) __PYX_ERR(0, 2262, __pyx_L1_error)

  /* "mathics/core/expression.py":2265
 *         update(b"System`Integer>" + str(self.value).encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */
  __pyx_tuple__574 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__574)) __PYX_ERR(0, 2265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__574);
  __Pyx_GIVEREF(__pyx_tuple__574);
  __pyx_codeobj__575 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__574, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_getnewargs, 2265, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__575)) __PYX_ERR(0, 2265, __pyx_L1_error)

  /* "mathics/core/expression.py":2268
 *         return (self.value,)
 * 
 *     def __neg__(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(-self.value)
 * 
 */
  __pyx_tuple__576 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__576)) __PYX_ERR(0, 2268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__576);
  __Pyx_GIVEREF(__pyx_tuple__576);
  __pyx_codeobj__577 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__576, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_neg, 2268, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__577)) __PYX_ERR(0, 2268, __pyx_L1_error)

  /* "mathics/core/expression.py":2272
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0
 * 
 */
  __pyx_tuple__578 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__578)) __PYX_ERR(0, 2272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__578);
  __Pyx_GIVEREF(__pyx_tuple__578);
  __pyx_codeobj__579 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__578, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_zero, 2272, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__579)) __PYX_ERR(0, 2272, __pyx_L1_error)

  /* "mathics/core/expression.py":2276
 * 
 * 
 * Integer0 = Integer(0)             # <<<<<<<<<<<<<<
 * Integer1 = Integer(1)
 * 
 */
  __pyx_tuple__580 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__580)) __PYX_ERR(0, 2276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__580);
  __Pyx_GIVEREF(__pyx_tuple__580);

  /* "mathics/core/expression.py":2277
 * 
 * Integer0 = Integer(0)
 * Integer1 = Integer(1)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__581 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__581)) __PYX_ERR(0, 2277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__581);
  __Pyx_GIVEREF(__pyx_tuple__581);

  /* "mathics/core/expression.py":2282
 * class Rational(Number):
 *     @lru_cache()
 *     def __new__(cls, numerator, denominator=1) -> "Rational":             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         self.value = sympy.Rational(numerator, denominator)
 */
  __pyx_tuple__582 = PyTuple_Pack(4, __pyx_n_s_cls, __pyx_n_s_numerator, __pyx_n_s_denominator, __pyx_n_s_self); if (unlikely(!__pyx_tuple__582)) __PYX_ERR(0, 2282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__582);
  __Pyx_GIVEREF(__pyx_tuple__582);
  __pyx_codeobj__583 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__582, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 2282, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__583)) __PYX_ERR(0, 2282, __pyx_L1_error)
  __pyx_tuple__584 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__584)) __PYX_ERR(0, 2282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__584);
  __Pyx_GIVEREF(__pyx_tuple__584);

  /* "mathics/core/expression.py":2287
 *         return self
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.format(evaluation, f.get_name())
 * 
 */
  __pyx_tuple__585 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_f, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__585)) __PYX_ERR(0, 2287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__585);
  __Pyx_GIVEREF(__pyx_tuple__585);
  __pyx_codeobj__586 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__585, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_atom_to_boxes, 2287, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__586)) __PYX_ERR(0, 2287, __pyx_L1_error)

  /* "mathics/core/expression.py":2290
 *         return self.format(evaluation, f.get_name())
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_tuple__587 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__587)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__587);
  __Pyx_GIVEREF(__pyx_tuple__587);
  __pyx_codeobj__588 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__587, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_sympy, 2290, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__588)) __PYX_ERR(0, 2290, __pyx_L1_error)

  /* "mathics/core/expression.py":2293
 *         return self.value
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */
  __pyx_tuple__589 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__589)) __PYX_ERR(0, 2293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__589);
  __Pyx_GIVEREF(__pyx_tuple__589);
  __pyx_codeobj__590 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__589, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_mpmath, 2293, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__590)) __PYX_ERR(0, 2293, __pyx_L1_error)

  /* "mathics/core/expression.py":2296
 *         return mpmath.mpf(self.value)
 * 
 *     def to_python(self, *args, **kwargs) -> float:             # <<<<<<<<<<<<<<
 *         return float(self.value)
 * 
 */
  __pyx_tuple__591 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__591)) __PYX_ERR(0, 2296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__591);
  __Pyx_GIVEREF(__pyx_tuple__591);
  __pyx_codeobj__592 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__591, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_python, 2296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__592)) __PYX_ERR(0, 2296, __pyx_L1_error)

  /* "mathics/core/expression.py":2299
 *         return float(self.value)
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */
  __pyx_tuple__593 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_d); if (unlikely(!__pyx_tuple__593)) __PYX_ERR(0, 2299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__593);
  __Pyx_GIVEREF(__pyx_tuple__593);
  __pyx_codeobj__594 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__593, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_round, 2299, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__594)) __PYX_ERR(0, 2299, __pyx_L1_error)
  __pyx_tuple__595 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__595)) __PYX_ERR(0, 2299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__595);
  __Pyx_GIVEREF(__pyx_tuple__595);

  /* "mathics/core/expression.py":2305
 *             return PrecisionReal(self.value.n(d))
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, Rational) and self.value == other.value
 */
  __pyx_tuple__596 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__596)) __PYX_ERR(0, 2305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__596);
  __Pyx_GIVEREF(__pyx_tuple__596);
  __pyx_codeobj__597 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__596, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sameQ, 2305, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__597)) __PYX_ERR(0, 2305, __pyx_L1_error)

  /* "mathics/core/expression.py":2309
 *         return isinstance(other, Rational) and self.value == other.value
 * 
 *     def numerator(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value.as_numer_denom()[0])
 * 
 */
  __pyx_tuple__598 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__598)) __PYX_ERR(0, 2309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__598);
  __Pyx_GIVEREF(__pyx_tuple__598);
  __pyx_codeobj__599 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__598, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_numerator, 2309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__599)) __PYX_ERR(0, 2309, __pyx_L1_error)

  /* "mathics/core/expression.py":2312
 *         return Integer(self.value.as_numer_denom()[0])
 * 
 *     def denominator(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value.as_numer_denom()[1])
 * 
 */
  __pyx_tuple__600 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__600)) __PYX_ERR(0, 2312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__600);
  __Pyx_GIVEREF(__pyx_tuple__600);
  __pyx_codeobj__601 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__600, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_denominator, 2312, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__601)) __PYX_ERR(0, 2312, __pyx_L1_error)

  /* "mathics/core/expression.py":2315
 *         return Integer(self.value.as_numer_denom()[1])
 * 
 *     def do_format(self, evaluation, form) -> "Expression":             # <<<<<<<<<<<<<<
 *         assert fully_qualified_symbol_name(form)
 *         if form == "System`FullForm":
 */
  __pyx_tuple__602 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form, __pyx_n_s_numerator, __pyx_n_s_minus, __pyx_n_s_result); if (unlikely(!__pyx_tuple__602)) __PYX_ERR(0, 2315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__602);
  __Pyx_GIVEREF(__pyx_tuple__602);
  __pyx_codeobj__603 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__602, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_format, 2315, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__603)) __PYX_ERR(0, 2315, __pyx_L1_error)

  /* "mathics/core/expression.py":2334
 *             return result.do_format(evaluation, form)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "Rational[%s, %s]" % self.value.as_numer_denom()
 * 
 */
  __pyx_tuple__604 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form); if (unlikely(!__pyx_tuple__604)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__604);
  __Pyx_GIVEREF(__pyx_tuple__604);
  __pyx_codeobj__605 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__604, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_default_format, 2334, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__605)) __PYX_ERR(0, 2334, __pyx_L1_error)

  /* "mathics/core/expression.py":2337
 *         return "Rational[%s, %s]" % self.value.as_numer_denom()
 * 
 *     def evaluate(self, evaluation) -> "Rational":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */
  __pyx_tuple__606 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__606)) __PYX_ERR(0, 2337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__606);
  __Pyx_GIVEREF(__pyx_tuple__606);
  __pyx_codeobj__607 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__606, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate, 2337, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__607)) __PYX_ERR(0, 2337, __pyx_L1_error)

  /* "mathics/core/expression.py":2341
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_tuple__608 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pattern_sort); if (unlikely(!__pyx_tuple__608)) __PYX_ERR(0, 2341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__608);
  __Pyx_GIVEREF(__pyx_tuple__608);
  __pyx_codeobj__609 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__608, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sort_key, 2341, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__609)) __PYX_ERR(0, 2341, __pyx_L1_error)
  __pyx_tuple__610 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__610)) __PYX_ERR(0, 2341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__610);
  __Pyx_GIVEREF(__pyx_tuple__610);

  /* "mathics/core/expression.py":2348
 *             return [0, 0, sympy.Float(self.value), 0, 1]
 * 
 *     def do_copy(self) -> "Rational":             # <<<<<<<<<<<<<<
 *         return Rational(self.value)
 * 
 */
  __pyx_tuple__611 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__611)) __PYX_ERR(0, 2348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__611);
  __Pyx_GIVEREF(__pyx_tuple__611);
  __pyx_codeobj__612 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__611, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_copy, 2348, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__612)) __PYX_ERR(0, 2348, __pyx_L1_error)

  /* "mathics/core/expression.py":2351
 *         return Rational(self.value)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Rational", self.value))
 * 
 */
  __pyx_tuple__613 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__613)) __PYX_ERR(0, 2351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__613);
  __Pyx_GIVEREF(__pyx_tuple__613);
  __pyx_codeobj__614 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__613, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_hash, 2351, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__614)) __PYX_ERR(0, 2351, __pyx_L1_error)

  /* "mathics/core/expression.py":2354
 *         return hash(("Rational", self.value))
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(
 *             b"System`Rational>" + ("%s>%s" % self.value.as_numer_denom()).encode("utf8")
 */
  __pyx_tuple__615 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_update); if (unlikely(!__pyx_tuple__615)) __PYX_ERR(0, 2354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__615);
  __Pyx_GIVEREF(__pyx_tuple__615);
  __pyx_codeobj__616 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__615, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_user_hash, 2354, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__616)) __PYX_ERR(0, 2354, __pyx_L1_error)

  /* "mathics/core/expression.py":2359
 *         )
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.numerator().get_int_value(), self.denominator().get_int_value())
 * 
 */
  __pyx_tuple__617 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__617)) __PYX_ERR(0, 2359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__617);
  __Pyx_GIVEREF(__pyx_tuple__617);
  __pyx_codeobj__618 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__617, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_getnewargs, 2359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__618)) __PYX_ERR(0, 2359, __pyx_L1_error)

  /* "mathics/core/expression.py":2362
 *         return (self.numerator().get_int_value(), self.denominator().get_int_value())
 * 
 *     def __neg__(self) -> "Rational":             # <<<<<<<<<<<<<<
 *         return Rational(
 *             -self.numerator().get_int_value(), self.denominator().get_int_value()
 */
  __pyx_tuple__619 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__619)) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__619);
  __Pyx_GIVEREF(__pyx_tuple__619);
  __pyx_codeobj__620 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__619, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_neg, 2362, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__620)) __PYX_ERR(0, 2362, __pyx_L1_error)

  /* "mathics/core/expression.py":2368
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             self.numerator().is_zero
 */
  __pyx_tuple__621 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__621)) __PYX_ERR(0, 2368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__621);
  __Pyx_GIVEREF(__pyx_tuple__621);
  __pyx_codeobj__622 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__621, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_zero, 2368, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__622)) __PYX_ERR(0, 2368, __pyx_L1_error)

  /* "mathics/core/expression.py":2374
 * 
 * 
 * RationalOneHalf = Rational(1, 2)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__623 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_2); if (unlikely(!__pyx_tuple__623)) __PYX_ERR(0, 2374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__623);
  __Pyx_GIVEREF(__pyx_tuple__623);

  /* "mathics/core/expression.py":2378
 * 
 * class Real(Number):
 *     def __new__(cls, value, p=None) -> "Real":             # <<<<<<<<<<<<<<
 *         if isinstance(value, str):
 *             value = str(value)
 */
  __pyx_tuple__624 = PyTuple_Pack(4, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_p, __pyx_n_s_digits); if (unlikely(!__pyx_tuple__624)) __PYX_ERR(0, 2378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__624);
  __Pyx_GIVEREF(__pyx_tuple__624);
  __pyx_codeobj__625 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__624, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 2378, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__625)) __PYX_ERR(0, 2378, __pyx_L1_error)
  __pyx_tuple__626 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__626)) __PYX_ERR(0, 2378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__626);
  __Pyx_GIVEREF(__pyx_tuple__626);

  /* "mathics/core/expression.py":2402
 *             return PrecisionReal.__new__(PrecisionReal, value)
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`OutputForm").boxes_to_text(**options)
 * 
 */
  __pyx_tuple__627 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_options); if (unlikely(!__pyx_tuple__627)) __PYX_ERR(0, 2402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__627);
  __Pyx_GIVEREF(__pyx_tuple__627);
  __pyx_codeobj__628 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__627, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_text, 2402, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__628)) __PYX_ERR(0, 2402, __pyx_L1_error)

  /* "mathics/core/expression.py":2405
 *         return self.make_boxes("System`OutputForm").boxes_to_text(**options)
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`MathMLForm").boxes_to_mathml(**options)
 * 
 */
  __pyx_tuple__629 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_options); if (unlikely(!__pyx_tuple__629)) __PYX_ERR(0, 2405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__629);
  __Pyx_GIVEREF(__pyx_tuple__629);
  __pyx_codeobj__630 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__629, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_mathml, 2405, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__630)) __PYX_ERR(0, 2405, __pyx_L1_error)

  /* "mathics/core/expression.py":2408
 *         return self.make_boxes("System`MathMLForm").boxes_to_mathml(**options)
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`TeXForm").boxes_to_tex(**options)
 * 
 */
  __pyx_tuple__631 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_options); if (unlikely(!__pyx_tuple__631)) __PYX_ERR(0, 2408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__631);
  __Pyx_GIVEREF(__pyx_tuple__631);
  __pyx_codeobj__632 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__631, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_tex, 2408, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__632)) __PYX_ERR(0, 2408, __pyx_L1_error)

  /* "mathics/core/expression.py":2411
 *         return self.make_boxes("System`TeXForm").boxes_to_tex(**options)
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.make_boxes(f.get_name())
 * 
 */
  __pyx_tuple__633 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_f, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__633)) __PYX_ERR(0, 2411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__633);
  __Pyx_GIVEREF(__pyx_tuple__633);
  __pyx_codeobj__634 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__633, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_atom_to_boxes, 2411, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__634)) __PYX_ERR(0, 2411, __pyx_L1_error)

  /* "mathics/core/expression.py":2414
 *         return self.make_boxes(f.get_name())
 * 
 *     def evaluate(self, evaluation) -> "Real":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */
  __pyx_tuple__635 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__635)) __PYX_ERR(0, 2414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__635);
  __Pyx_GIVEREF(__pyx_tuple__635);
  __pyx_codeobj__636 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__635, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate, 2414, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__636)) __PYX_ERR(0, 2414, __pyx_L1_error)

  /* "mathics/core/expression.py":2418
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_tuple__637 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pattern_sort); if (unlikely(!__pyx_tuple__637)) __PYX_ERR(0, 2418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__637);
  __Pyx_GIVEREF(__pyx_tuple__637);
  __pyx_codeobj__638 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__637, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sort_key, 2418, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__638)) __PYX_ERR(0, 2418, __pyx_L1_error)
  __pyx_tuple__639 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__639)) __PYX_ERR(0, 2418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__639);
  __Pyx_GIVEREF(__pyx_tuple__639);

  /* "mathics/core/expression.py":2423
 *         return [0, 0, self.value, 0, 1]
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         if isinstance(other, Real):
 *             # MMA Docs: "Approximate numbers that differ in their last seven
 */
  __pyx_tuple__640 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_other, __pyx_n_s_prec_2, __pyx_n_s_rel_eps); if (unlikely(!__pyx_tuple__640)) __PYX_ERR(0, 2423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__640);
  __Pyx_GIVEREF(__pyx_tuple__640);
  __pyx_codeobj__641 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__640, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_eq, 2423, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__641)) __PYX_ERR(0, 2423, __pyx_L1_error)

  /* "mathics/core/expression.py":2436
 *             return self.get_sort_key() == other.get_sort_key()
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         # Real is a total order
 *         return not (self == other)
 */
  __pyx_tuple__642 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__642)) __PYX_ERR(0, 2436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__642);
  __Pyx_GIVEREF(__pyx_tuple__642);
  __pyx_codeobj__643 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__642, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_ne, 2436, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__643)) __PYX_ERR(0, 2436, __pyx_L1_error)

  /* "mathics/core/expression.py":2440
 *         return not (self == other)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()
 */
  __pyx_tuple__644 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_prec_2); if (unlikely(!__pyx_tuple__644)) __PYX_ERR(0, 2440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__644);
  __Pyx_GIVEREF(__pyx_tuple__644);
  __pyx_codeobj__645 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__644, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_hash, 2440, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__645)) __PYX_ERR(0, 2440, __pyx_L1_error)

  /* "mathics/core/expression.py":2445
 *         return hash(("Real", self.to_sympy().n(dps(_prec))))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()
 */
  __pyx_tuple__646 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_update, __pyx_n_s_prec_2); if (unlikely(!__pyx_tuple__646)) __PYX_ERR(0, 2445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__646);
  __Pyx_GIVEREF(__pyx_tuple__646);
  __pyx_codeobj__647 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__646, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_user_hash, 2445, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__647)) __PYX_ERR(0, 2445, __pyx_L1_error)

  /* "mathics/core/expression.py":2450
 *         update(b"System`Real>" + str(self.to_sympy().n(dps(_prec))).encode("utf8"))
 * 
 *     def get_atom_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return "Real"
 * 
 */
  __pyx_tuple__648 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__648)) __PYX_ERR(0, 2450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__648);
  __Pyx_GIVEREF(__pyx_tuple__648);
  __pyx_codeobj__649 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__648, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_atom_name, 2450, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__649)) __PYX_ERR(0, 2450, __pyx_L1_error)

  /* "mathics/core/expression.py":2463
 *     value: float
 * 
 *     def __new__(cls, value) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         self = Number.__new__(cls)
 *         self.value = float(value)
 */
  __pyx_tuple__650 = PyTuple_Pack(3, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_self); if (unlikely(!__pyx_tuple__650)) __PYX_ERR(0, 2463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__650);
  __Pyx_GIVEREF(__pyx_tuple__650);
  __pyx_codeobj__651 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__650, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 2463, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__651)) __PYX_ERR(0, 2463, __pyx_L1_error)

  /* "mathics/core/expression.py":2470
 *         return self
 * 
 *     def to_python(self, *args, **kwargs) -> float:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_tuple__652 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__652)) __PYX_ERR(0, 2470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__652);
  __Pyx_GIVEREF(__pyx_tuple__652);
  __pyx_codeobj__653 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__652, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_python, 2470, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__653)) __PYX_ERR(0, 2470, __pyx_L1_error)

  /* "mathics/core/expression.py":2473
 *         return self.value
 * 
 *     def to_sympy(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return sympy.Float(self.value)
 * 
 */
  __pyx_tuple__654 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__654)) __PYX_ERR(0, 2473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__654);
  __Pyx_GIVEREF(__pyx_tuple__654);
  __pyx_codeobj__655 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__654, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_sympy, 2473, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__655)) __PYX_ERR(0, 2473, __pyx_L1_error)

  /* "mathics/core/expression.py":2476
 *         return sympy.Float(self.value)
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */
  __pyx_tuple__656 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__656)) __PYX_ERR(0, 2476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__656);
  __Pyx_GIVEREF(__pyx_tuple__656);
  __pyx_codeobj__657 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__656, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_mpmath, 2476, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__657)) __PYX_ERR(0, 2476, __pyx_L1_error)

  /* "mathics/core/expression.py":2479
 *         return mpmath.mpf(self.value)
 * 
 *     def round(self, d=None) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_tuple__658 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_d); if (unlikely(!__pyx_tuple__658)) __PYX_ERR(0, 2479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__658);
  __Pyx_GIVEREF(__pyx_tuple__658);
  __pyx_codeobj__659 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__658, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_round, 2479, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__659)) __PYX_ERR(0, 2479, __pyx_L1_error)
  __pyx_tuple__660 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__660)) __PYX_ERR(0, 2479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__660);
  __Pyx_GIVEREF(__pyx_tuple__660);

  /* "mathics/core/expression.py":2482
 *         return self
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if isinstance(other, MachineReal):
 */
  __pyx_tuple__661 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__661)) __PYX_ERR(0, 2482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__661);
  __Pyx_GIVEREF(__pyx_tuple__661);
  __pyx_codeobj__662 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__661, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sameQ, 2482, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__662)) __PYX_ERR(0, 2482, __pyx_L1_error)

  /* "mathics/core/expression.py":2490
 *         return False
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_tuple__663 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__663)) __PYX_ERR(0, 2490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__663);
  __Pyx_GIVEREF(__pyx_tuple__663);
  __pyx_codeobj__664 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__663, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_machine_precision, 2490, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__664)) __PYX_ERR(0, 2490, __pyx_L1_error)

  /* "mathics/core/expression.py":2493
 *         return True
 * 
 *     def get_precision(self) -> int:             # <<<<<<<<<<<<<<
 *         return machine_precision
 * 
 */
  __pyx_tuple__665 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__665)) __PYX_ERR(0, 2493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__665);
  __Pyx_GIVEREF(__pyx_tuple__665);
  __pyx_codeobj__666 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__665, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_precision, 2493, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__666)) __PYX_ERR(0, 2493, __pyx_L1_error)

  /* "mathics/core/expression.py":2496
 *         return machine_precision
 * 
 *     def get_float_value(self, permit_complex=False) -> float:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_tuple__667 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_permit_complex); if (unlikely(!__pyx_tuple__667)) __PYX_ERR(0, 2496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__667);
  __Pyx_GIVEREF(__pyx_tuple__667);
  __pyx_codeobj__668 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__667, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_float_value, 2496, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__668)) __PYX_ERR(0, 2496, __pyx_L1_error)
  __pyx_tuple__669 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__669)) __PYX_ERR(0, 2496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__669);
  __Pyx_GIVEREF(__pyx_tuple__669);

  /* "mathics/core/expression.py":2499
 *         return self.value
 * 
 *     def make_boxes(self, form):             # <<<<<<<<<<<<<<
 *         from mathics.builtin.inout import number_form
 * 
 */
  __pyx_tuple__670 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_form, __pyx_n_s_number_form, __pyx_n_s_n); if (unlikely(!__pyx_tuple__670)) __PYX_ERR(0, 2499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__670);
  __Pyx_GIVEREF(__pyx_tuple__670);
  __pyx_codeobj__671 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__670, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_make_boxes, 2499, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__671)) __PYX_ERR(0, 2499, __pyx_L1_error)

  /* "mathics/core/expression.py":2509
 *         return number_form(self, n, None, None, _number_form_options)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */
  __pyx_tuple__672 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__672)) __PYX_ERR(0, 2509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__672);
  __Pyx_GIVEREF(__pyx_tuple__672);
  __pyx_codeobj__673 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__672, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_getnewargs, 2509, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__673)) __PYX_ERR(0, 2509, __pyx_L1_error)

  /* "mathics/core/expression.py":2512
 *         return (self.value,)
 * 
 *     def do_copy(self) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return MachineReal(self.value)
 * 
 */
  __pyx_tuple__674 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__674)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__674);
  __Pyx_GIVEREF(__pyx_tuple__674);
  __pyx_codeobj__675 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__674, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_copy, 2512, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__675)) __PYX_ERR(0, 2512, __pyx_L1_error)

  /* "mathics/core/expression.py":2515
 *         return MachineReal(self.value)
 * 
 *     def __neg__(self) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return MachineReal(-self.value)
 * 
 */
  __pyx_tuple__676 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__676)) __PYX_ERR(0, 2515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__676);
  __Pyx_GIVEREF(__pyx_tuple__676);
  __pyx_codeobj__677 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__676, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_neg, 2515, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__677)) __PYX_ERR(0, 2515, __pyx_L1_error)

  /* "mathics/core/expression.py":2519
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0.0
 * 
 */
  __pyx_tuple__678 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__678)) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__678);
  __Pyx_GIVEREF(__pyx_tuple__678);
  __pyx_codeobj__679 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__678, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_zero, 2519, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__679)) __PYX_ERR(0, 2519, __pyx_L1_error)

  /* "mathics/core/expression.py":2523
 * 
 *     @property
 *     def is_approx_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         # In WMA, Chop[10.^(-10)] == 0,
 *         # so, lets take it.
 */
  __pyx_tuple__680 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_res); if (unlikely(!__pyx_tuple__680)) __PYX_ERR(0, 2523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__680);
  __Pyx_GIVEREF(__pyx_tuple__680);
  __pyx_codeobj__681 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__680, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_approx_zero, 2523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__681)) __PYX_ERR(0, 2523, __pyx_L1_error)

  /* "mathics/core/expression.py":2541
 *     value: sympy.Float
 * 
 *     def __new__(cls, value) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         self = Number.__new__(cls)
 *         self.value = sympy.Float(value)
 */
  __pyx_tuple__682 = PyTuple_Pack(3, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_self); if (unlikely(!__pyx_tuple__682)) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__682);
  __Pyx_GIVEREF(__pyx_tuple__682);
  __pyx_codeobj__683 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__682, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 2541, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__683)) __PYX_ERR(0, 2541, __pyx_L1_error)

  /* "mathics/core/expression.py":2546
 *         return self
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return float(self.value)
 * 
 */
  __pyx_tuple__684 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__684)) __PYX_ERR(0, 2546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__684);
  __Pyx_GIVEREF(__pyx_tuple__684);
  __pyx_codeobj__685 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__684, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_python, 2546, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__685)) __PYX_ERR(0, 2546, __pyx_L1_error)

  /* "mathics/core/expression.py":2549
 *         return float(self.value)
 * 
 *     def to_sympy(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_tuple__686 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__686)) __PYX_ERR(0, 2549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__686);
  __Pyx_GIVEREF(__pyx_tuple__686);
  __pyx_codeobj__687 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__686, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_sympy, 2549, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__687)) __PYX_ERR(0, 2549, __pyx_L1_error)

  /* "mathics/core/expression.py":2552
 *         return self.value
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */
  __pyx_tuple__688 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__688)) __PYX_ERR(0, 2552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__688);
  __Pyx_GIVEREF(__pyx_tuple__688);
  __pyx_codeobj__689 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__688, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_mpmath, 2552, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__689)) __PYX_ERR(0, 2552, __pyx_L1_error)

  /* "mathics/core/expression.py":2555
 *         return mpmath.mpf(self.value)
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */
  __pyx_tuple__690 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_d); if (unlikely(!__pyx_tuple__690)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__690);
  __Pyx_GIVEREF(__pyx_tuple__690);
  __pyx_codeobj__691 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__690, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_round, 2555, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__691)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __pyx_tuple__692 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__692)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__692);
  __Pyx_GIVEREF(__pyx_tuple__692);

  /* "mathics/core/expression.py":2562
 *             return PrecisionReal(self.value.n(d))
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if isinstance(other, PrecisionReal):
 */
  __pyx_tuple__693 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__693)) __PYX_ERR(0, 2562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__693);
  __Pyx_GIVEREF(__pyx_tuple__693);
  __pyx_codeobj__694 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__693, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sameQ, 2562, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__694)) __PYX_ERR(0, 2562, __pyx_L1_error)

  /* "mathics/core/expression.py":2570
 *         return False
 * 
 *     def get_precision(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.value._prec + 1
 * 
 */
  __pyx_tuple__695 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__695)) __PYX_ERR(0, 2570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__695);
  __Pyx_GIVEREF(__pyx_tuple__695);
  __pyx_codeobj__696 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__695, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_precision, 2570, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__696)) __PYX_ERR(0, 2570, __pyx_L1_error)

  /* "mathics/core/expression.py":2573
 *         return self.value._prec + 1
 * 
 *     def make_boxes(self, form):             # <<<<<<<<<<<<<<
 *         from mathics.builtin.inout import number_form
 * 
 */
  __pyx_tuple__697 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_form, __pyx_n_s_number_form); if (unlikely(!__pyx_tuple__697)) __PYX_ERR(0, 2573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__697);
  __Pyx_GIVEREF(__pyx_tuple__697);
  __pyx_codeobj__698 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__697, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_make_boxes, 2573, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__698)) __PYX_ERR(0, 2573, __pyx_L1_error)

  /* "mathics/core/expression.py":2581
 *         )
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */
  __pyx_tuple__699 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__699)) __PYX_ERR(0, 2581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__699);
  __Pyx_GIVEREF(__pyx_tuple__699);
  __pyx_codeobj__700 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__699, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_getnewargs, 2581, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__700)) __PYX_ERR(0, 2581, __pyx_L1_error)

  /* "mathics/core/expression.py":2584
 *         return (self.value,)
 * 
 *     def do_copy(self) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         return PrecisionReal(self.value)
 * 
 */
  __pyx_tuple__701 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__701)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__701);
  __Pyx_GIVEREF(__pyx_tuple__701);
  __pyx_codeobj__702 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__701, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_copy, 2584, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__702)) __PYX_ERR(0, 2584, __pyx_L1_error)

  /* "mathics/core/expression.py":2587
 *         return PrecisionReal(self.value)
 * 
 *     def __neg__(self) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         return PrecisionReal(-self.value)
 * 
 */
  __pyx_tuple__703 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__703)) __PYX_ERR(0, 2587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__703);
  __Pyx_GIVEREF(__pyx_tuple__703);
  __pyx_codeobj__704 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__703, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_neg, 2587, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__704)) __PYX_ERR(0, 2587, __pyx_L1_error)

  /* "mathics/core/expression.py":2591
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0.0
 * 
 */
  __pyx_tuple__705 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__705)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__705);
  __Pyx_GIVEREF(__pyx_tuple__705);
  __pyx_codeobj__706 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__705, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_zero, 2591, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__706)) __PYX_ERR(0, 2591, __pyx_L1_error)

  /* "mathics/core/expression.py":2603
 *     imag: Any
 * 
 *     def __new__(cls, real, imag):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if isinstance(real, Complex) or not isinstance(real, Number):
 */
  __pyx_tuple__707 = PyTuple_Pack(4, __pyx_n_s_cls, __pyx_n_s_real, __pyx_n_s_imag, __pyx_n_s_self); if (unlikely(!__pyx_tuple__707)) __PYX_ERR(0, 2603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__707);
  __Pyx_GIVEREF(__pyx_tuple__707);
  __pyx_codeobj__708 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__707, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 2603, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__708)) __PYX_ERR(0, 2603, __pyx_L1_error)

  /* "mathics/core/expression.py":2622
 *         return self
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.format(evaluation, f.get_name())
 * 
 */
  __pyx_tuple__709 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_f, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__709)) __PYX_ERR(0, 2622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__709);
  __Pyx_GIVEREF(__pyx_tuple__709);
  __pyx_codeobj__710 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__709, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_atom_to_boxes, 2622, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__710)) __PYX_ERR(0, 2622, __pyx_L1_error)

  /* "mathics/core/expression.py":2625
 *         return self.format(evaluation, f.get_name())
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.to_sympy())
 * 
 */
  __pyx_tuple__711 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__711)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__711);
  __Pyx_GIVEREF(__pyx_tuple__711);
  __pyx_codeobj__712 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__711, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_str, 2625, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__712)) __PYX_ERR(0, 2625, __pyx_L1_error)

  /* "mathics/core/expression.py":2628
 *         return str(self.to_sympy())
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.real.to_sympy() + sympy.I * self.imag.to_sympy()
 * 
 */
  __pyx_tuple__713 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__713)) __PYX_ERR(0, 2628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__713);
  __Pyx_GIVEREF(__pyx_tuple__713);
  __pyx_codeobj__714 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__713, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_sympy, 2628, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__714)) __PYX_ERR(0, 2628, __pyx_L1_error)

  /* "mathics/core/expression.py":2631
 *         return self.real.to_sympy() + sympy.I * self.imag.to_sympy()
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return complex(
 *             self.real.to_python(*args, **kwargs), self.imag.to_python(*args, **kwargs)
 */
  __pyx_tuple__715 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__715)) __PYX_ERR(0, 2631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__715);
  __Pyx_GIVEREF(__pyx_tuple__715);
  __pyx_codeobj__716 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__715, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_python, 2631, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__716)) __PYX_ERR(0, 2631, __pyx_L1_error)

  /* "mathics/core/expression.py":2636
 *         )
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpc(self.real.to_mpmath(), self.imag.to_mpmath())
 * 
 */
  __pyx_tuple__717 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__717)) __PYX_ERR(0, 2636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__717);
  __Pyx_GIVEREF(__pyx_tuple__717);
  __pyx_codeobj__718 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__717, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_mpmath, 2636, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__718)) __PYX_ERR(0, 2636, __pyx_L1_error)

  /* "mathics/core/expression.py":2639
 *         return mpmath.mpc(self.real.to_mpmath(), self.imag.to_mpmath())
 * 
 *     def do_format(self, evaluation, form) -> "Expression":             # <<<<<<<<<<<<<<
 *         if form == "System`FullForm":
 *             return Expression(
 */
  __pyx_tuple__719 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form, __pyx_n_s_parts, __pyx_n_s_result); if (unlikely(!__pyx_tuple__719)) __PYX_ERR(0, 2639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__719);
  __Pyx_GIVEREF(__pyx_tuple__719);
  __pyx_codeobj__720 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__719, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_format, 2639, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__720)) __PYX_ERR(0, 2639, __pyx_L1_error)

  /* "mathics/core/expression.py":2660
 *         return Expression("HoldForm", result).do_format(evaluation, form)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "Complex[%s, %s]" % (
 *             self.real.default_format(evaluation, form),
 */
  __pyx_tuple__721 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form); if (unlikely(!__pyx_tuple__721)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__721);
  __Pyx_GIVEREF(__pyx_tuple__721);
  __pyx_codeobj__722 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__721, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_default_format, 2660, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__722)) __PYX_ERR(0, 2660, __pyx_L1_error)

  /* "mathics/core/expression.py":2666
 *         )
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_tuple__723 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pattern_sort); if (unlikely(!__pyx_tuple__723)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__723);
  __Pyx_GIVEREF(__pyx_tuple__723);
  __pyx_codeobj__724 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__723, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sort_key, 2666, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__724)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __pyx_tuple__725 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__725)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__725);
  __Pyx_GIVEREF(__pyx_tuple__725);

  /* "mathics/core/expression.py":2672
 *             return [0, 0, self.real.get_sort_key()[2], self.imag.get_sort_key()[2], 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return (
 */
  __pyx_tuple__726 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__726)) __PYX_ERR(0, 2672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__726);
  __Pyx_GIVEREF(__pyx_tuple__726);
  __pyx_codeobj__727 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__726, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sameQ, 2672, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__727)) __PYX_ERR(0, 2672, __pyx_L1_error)

  /* "mathics/core/expression.py":2680
 *         )
 * 
 *     def evaluate(self, evaluation) -> "Complex":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */
  __pyx_tuple__728 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__728)) __PYX_ERR(0, 2680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__728);
  __Pyx_GIVEREF(__pyx_tuple__728);
  __pyx_codeobj__729 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__728, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_evaluate, 2680, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__729)) __PYX_ERR(0, 2680, __pyx_L1_error)

  /* "mathics/core/expression.py":2684
 *         return self
 * 
 *     def round(self, d=None) -> "Complex":             # <<<<<<<<<<<<<<
 *         real = self.real.round(d)
 *         imag = self.imag.round(d)
 */
  __pyx_tuple__730 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_d, __pyx_n_s_real, __pyx_n_s_imag); if (unlikely(!__pyx_tuple__730)) __PYX_ERR(0, 2684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__730);
  __Pyx_GIVEREF(__pyx_tuple__730);
  __pyx_codeobj__731 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__730, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_round, 2684, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__731)) __PYX_ERR(0, 2684, __pyx_L1_error)
  __pyx_tuple__732 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__732)) __PYX_ERR(0, 2684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__732);
  __Pyx_GIVEREF(__pyx_tuple__732);

  /* "mathics/core/expression.py":2689
 *         return Complex(real, imag)
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         if self.real.is_machine_precision() or self.imag.is_machine_precision():
 *             return True
 */
  __pyx_tuple__733 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__733)) __PYX_ERR(0, 2689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__733);
  __Pyx_GIVEREF(__pyx_tuple__733);
  __pyx_codeobj__734 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__733, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_machine_precision, 2689, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__734)) __PYX_ERR(0, 2689, __pyx_L1_error)

  /* "mathics/core/expression.py":2694
 *         return False
 * 
 *     def get_float_value(self, permit_complex=False) -> typing.Optional[complex]:             # <<<<<<<<<<<<<<
 *         if permit_complex:
 *             real = self.real.get_float_value()
 */
  __pyx_tuple__735 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_permit_complex, __pyx_n_s_real, __pyx_n_s_imag); if (unlikely(!__pyx_tuple__735)) __PYX_ERR(0, 2694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__735);
  __Pyx_GIVEREF(__pyx_tuple__735);
  __pyx_codeobj__736 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__735, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_float_value, 2694, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__736)) __PYX_ERR(0, 2694, __pyx_L1_error)
  __pyx_tuple__737 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__737)) __PYX_ERR(0, 2694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__737);
  __Pyx_GIVEREF(__pyx_tuple__737);

  /* "mathics/core/expression.py":2703
 *             return None
 * 
 *     def get_precision(self) -> typing.Optional[int]:             # <<<<<<<<<<<<<<
 *         real_prec = self.real.get_precision()
 *         imag_prec = self.imag.get_precision()
 */
  __pyx_tuple__738 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_real_prec, __pyx_n_s_imag_prec); if (unlikely(!__pyx_tuple__738)) __PYX_ERR(0, 2703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__738);
  __Pyx_GIVEREF(__pyx_tuple__738);
  __pyx_codeobj__739 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__738, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_precision, 2703, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__739)) __PYX_ERR(0, 2703, __pyx_L1_error)

  /* "mathics/core/expression.py":2710
 *         return min(real_prec, imag_prec)
 * 
 *     def do_copy(self) -> "Complex":             # <<<<<<<<<<<<<<
 *         return Complex(self.real.do_copy(), self.imag.do_copy())
 * 
 */
  __pyx_tuple__740 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__740)) __PYX_ERR(0, 2710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__740);
  __Pyx_GIVEREF(__pyx_tuple__740);
  __pyx_codeobj__741 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__740, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_copy, 2710, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__741)) __PYX_ERR(0, 2710, __pyx_L1_error)

  /* "mathics/core/expression.py":2713
 *         return Complex(self.real.do_copy(), self.imag.do_copy())
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Complex", self.real, self.imag))
 * 
 */
  __pyx_tuple__742 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__742)) __PYX_ERR(0, 2713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__742);
  __Pyx_GIVEREF(__pyx_tuple__742);
  __pyx_codeobj__743 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__742, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_hash, 2713, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__743)) __PYX_ERR(0, 2713, __pyx_L1_error)

  /* "mathics/core/expression.py":2716
 *         return hash(("Complex", self.real, self.imag))
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(b"System`Complex>")
 *         update(self.real)
 */
  __pyx_tuple__744 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_update); if (unlikely(!__pyx_tuple__744)) __PYX_ERR(0, 2716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__744);
  __Pyx_GIVEREF(__pyx_tuple__744);
  __pyx_codeobj__745 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__744, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_user_hash, 2716, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__745)) __PYX_ERR(0, 2716, __pyx_L1_error)

  /* "mathics/core/expression.py":2721
 *         update(self.imag)
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         if isinstance(other, Complex):
 *             return self.real == other.real and self.imag == other.imag
 */
  __pyx_tuple__746 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__746)) __PYX_ERR(0, 2721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__746);
  __Pyx_GIVEREF(__pyx_tuple__746);
  __pyx_codeobj__747 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__746, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_eq, 2721, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__747)) __PYX_ERR(0, 2721, __pyx_L1_error)

  /* "mathics/core/expression.py":2727
 *             return self.get_sort_key() == other.get_sort_key()
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.real, self.imag)
 * 
 */
  __pyx_tuple__748 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__748)) __PYX_ERR(0, 2727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__748);
  __Pyx_GIVEREF(__pyx_tuple__748);
  __pyx_codeobj__749 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__748, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_getnewargs, 2727, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__749)) __PYX_ERR(0, 2727, __pyx_L1_error)

  /* "mathics/core/expression.py":2730
 *         return (self.real, self.imag)
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return Complex(-self.real, -self.imag)
 * 
 */
  __pyx_tuple__750 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__750)) __PYX_ERR(0, 2730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__750);
  __Pyx_GIVEREF(__pyx_tuple__750);
  __pyx_codeobj__751 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__750, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_neg, 2730, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__751)) __PYX_ERR(0, 2730, __pyx_L1_error)

  /* "mathics/core/expression.py":2734
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.real.is_zero and self.imag.is_zero
 * 
 */
  __pyx_tuple__752 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__752)) __PYX_ERR(0, 2734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__752);
  __Pyx_GIVEREF(__pyx_tuple__752);
  __pyx_codeobj__753 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__752, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_zero, 2734, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__753)) __PYX_ERR(0, 2734, __pyx_L1_error)

  /* "mathics/core/expression.py":2738
 * 
 *     @property
 *     def is_approx_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         real_zero = (
 *             self.real.is_approx_zero
 */
  __pyx_tuple__754 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_real_zero, __pyx_n_s_imag_zero); if (unlikely(!__pyx_tuple__754)) __PYX_ERR(0, 2738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__754);
  __Pyx_GIVEREF(__pyx_tuple__754);
  __pyx_codeobj__755 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__754, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_approx_zero, 2738, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__755)) __PYX_ERR(0, 2738, __pyx_L1_error)

  /* "mathics/core/expression.py":2752
 * 
 * 
 * def encode_mathml(text: str) -> str:             # <<<<<<<<<<<<<<
 *     text = text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
 *     text = text.replace('"', "&quot;").replace(" ", "&nbsp;")
 */
  __pyx_tuple__756 = PyTuple_Pack(1, __pyx_n_s_text); if (unlikely(!__pyx_tuple__756)) __PYX_ERR(0, 2752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__756);
  __Pyx_GIVEREF(__pyx_tuple__756);
  __pyx_codeobj__757 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__756, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_encode_mathml, 2752, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__757)) __PYX_ERR(0, 2752, __pyx_L1_error)

  /* "mathics/core/expression.py":2786
 * 
 * 
 * def encode_tex(text: str, in_text=False) -> str:             # <<<<<<<<<<<<<<
 *     def replace(match):
 *         c = match.group(1)
 */
  __pyx_tuple__773 = PyTuple_Pack(4, __pyx_n_s_text, __pyx_n_s_in_text, __pyx_n_s_replace, __pyx_n_s_replace); if (unlikely(!__pyx_tuple__773)) __PYX_ERR(0, 2786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__773);
  __Pyx_GIVEREF(__pyx_tuple__773);
  __pyx_codeobj__774 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__773, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_encode_tex, 2786, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__774)) __PYX_ERR(0, 2786, __pyx_L1_error)
  __pyx_tuple__775 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__775)) __PYX_ERR(0, 2786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__775);
  __Pyx_GIVEREF(__pyx_tuple__775);

  /* "mathics/core/expression.py":2823
 *     value: str
 * 
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         self.value = str(value)
 */
  __pyx_tuple__776 = PyTuple_Pack(3, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_self); if (unlikely(!__pyx_tuple__776)) __PYX_ERR(0, 2823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__776);
  __Pyx_GIVEREF(__pyx_tuple__776);
  __pyx_codeobj__777 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__776, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 2823, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__777)) __PYX_ERR(0, 2823, __pyx_L1_error)

  /* "mathics/core/expression.py":2828
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return '"%s"' % self.value
 * 
 */
  __pyx_tuple__778 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__778)) __PYX_ERR(0, 2828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__778);
  __Pyx_GIVEREF(__pyx_tuple__778);
  __pyx_codeobj__779 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__778, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_str, 2828, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__779)) __PYX_ERR(0, 2828, __pyx_L1_error)

  /* "mathics/core/expression.py":2831
 *         return '"%s"' % self.value
 * 
 *     def boxes_to_text(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value
 * 
 */
  __pyx_tuple__780 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_show_string_characters, __pyx_n_s_options, __pyx_n_s_value); if (unlikely(!__pyx_tuple__780)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__780);
  __Pyx_GIVEREF(__pyx_tuple__780);
  __pyx_codeobj__781 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__780, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_text, 2831, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__781)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __pyx_tuple__782 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__782)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__782);
  __Pyx_GIVEREF(__pyx_tuple__782);

  /* "mathics/core/expression.py":2843
 *         return value
 * 
 *     def boxes_to_mathml(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         from mathics.core.parser import is_symbol_name
 *         from mathics.builtin import builtins_by_module
 */
  __pyx_tuple__783 = PyTuple_Pack(15, __pyx_n_s_self, __pyx_n_s_show_string_characters, __pyx_n_s_options, __pyx_n_s_is_symbol_name, __pyx_n_s_builtins_by_module, __pyx_n_s_operators, __pyx_n_s_modname, __pyx_n_s_builtins, __pyx_n_s_builtin, __pyx_n_s_operator, __pyx_n_s_text, __pyx_n_s_render, __pyx_n_s_render, __pyx_n_s_outtext, __pyx_n_s_line); if (unlikely(!__pyx_tuple__783)) __PYX_ERR(0, 2843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__783);
  __Pyx_GIVEREF(__pyx_tuple__783);
  __pyx_codeobj__784 = (PyObject*)__Pyx_PyCode_New(2, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__783, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_mathml, 2843, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__784)) __PYX_ERR(0, 2843, __pyx_L1_error)
  __pyx_tuple__785 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__785)) __PYX_ERR(0, 2843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__785);
  __Pyx_GIVEREF(__pyx_tuple__785);

  /* "mathics/core/expression.py":2890
 *                 return outtext
 * 
 *     def boxes_to_tex(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         from mathics.builtin import builtins_by_module
 * 
 */
  __pyx_tuple__786 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_show_string_characters, __pyx_n_s_options, __pyx_n_s_builtins_by_module, __pyx_n_s_operators, __pyx_n_s_modname, __pyx_n_s_builtins, __pyx_n_s_builtin, __pyx_n_s_operator, __pyx_n_s_text, __pyx_n_s_render, __pyx_n_s_render); if (unlikely(!__pyx_tuple__786)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__786);
  __Pyx_GIVEREF(__pyx_tuple__786);
  __pyx_codeobj__787 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__786, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_tex, 2890, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__787)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __pyx_tuple__788 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__788)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__788);
  __Pyx_GIVEREF(__pyx_tuple__788);

  /* "mathics/core/expression.py":2947
 *                 return render("%s", text)
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         inner = str(self.value)
 * 
 */
  __pyx_tuple__789 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_f, __pyx_n_s_evaluation, __pyx_n_s_inner); if (unlikely(!__pyx_tuple__789)) __PYX_ERR(0, 2947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__789);
  __Pyx_GIVEREF(__pyx_tuple__789);
  __pyx_codeobj__790 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__789, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_atom_to_boxes, 2947, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__790)) __PYX_ERR(0, 2947, __pyx_L1_error)

  /* "mathics/core/expression.py":2955
 *         return String('"' + inner + '"')
 * 
 *     def do_copy(self) -> "String":             # <<<<<<<<<<<<<<
 *         return String(self.value)
 * 
 */
  __pyx_tuple__791 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__791)) __PYX_ERR(0, 2955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__791);
  __Pyx_GIVEREF(__pyx_tuple__791);
  __pyx_codeobj__792 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__791, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_copy, 2955, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__792)) __PYX_ERR(0, 2955, __pyx_L1_error)

  /* "mathics/core/expression.py":2958
 *         return String(self.value)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value.replace("\\", "\\\\").replace('"', '\\"')
 *         return '"%s"' % value
 */
  __pyx_tuple__793 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form, __pyx_n_s_value); if (unlikely(!__pyx_tuple__793)) __PYX_ERR(0, 2958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__793);
  __Pyx_GIVEREF(__pyx_tuple__793);
  __pyx_codeobj__794 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__793, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_default_format, 2958, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__794)) __PYX_ERR(0, 2958, __pyx_L1_error)

  /* "mathics/core/expression.py":2962
 *         return '"%s"' % value
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_tuple__795 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pattern_sort); if (unlikely(!__pyx_tuple__795)) __PYX_ERR(0, 2962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__795);
  __Pyx_GIVEREF(__pyx_tuple__795);
  __pyx_codeobj__796 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__795, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sort_key, 2962, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__796)) __PYX_ERR(0, 2962, __pyx_L1_error)
  __pyx_tuple__797 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__797)) __PYX_ERR(0, 2962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__797);
  __Pyx_GIVEREF(__pyx_tuple__797);

  /* "mathics/core/expression.py":2968
 *             return [0, 1, self.value, 0, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, String) and self.value == other.value
 */
  __pyx_tuple__798 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__798)) __PYX_ERR(0, 2968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__798);
  __Pyx_GIVEREF(__pyx_tuple__798);
  __pyx_codeobj__799 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__798, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sameQ, 2968, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__799)) __PYX_ERR(0, 2968, __pyx_L1_error)

  /* "mathics/core/expression.py":2972
 *         return isinstance(other, String) and self.value == other.value
 * 
 *     def get_string_value(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_tuple__800 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__800)) __PYX_ERR(0, 2972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__800);
  __Pyx_GIVEREF(__pyx_tuple__800);
  __pyx_codeobj__801 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__800, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_string_value, 2972, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__801)) __PYX_ERR(0, 2972, __pyx_L1_error)

  /* "mathics/core/expression.py":2975
 *         return self.value
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_tuple__802 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__802)) __PYX_ERR(0, 2975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__802);
  __Pyx_GIVEREF(__pyx_tuple__802);
  __pyx_codeobj__803 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__802, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_sympy, 2975, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__803)) __PYX_ERR(0, 2975, __pyx_L1_error)

  /* "mathics/core/expression.py":2978
 *         return None
 * 
 *     def to_python(self, *args, **kwargs) -> str:             # <<<<<<<<<<<<<<
 *         if kwargs.get("string_quotes", True):
 *             return '"%s"' % self.value  # add quotes to distinguish from Symbols
 */
  __pyx_tuple__804 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__804)) __PYX_ERR(0, 2978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__804);
  __Pyx_GIVEREF(__pyx_tuple__804);
  __pyx_codeobj__805 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__804, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_python, 2978, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__805)) __PYX_ERR(0, 2978, __pyx_L1_error)

  /* "mathics/core/expression.py":2984
 *             return self.value
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("String", self.value))
 * 
 */
  __pyx_tuple__806 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__806)) __PYX_ERR(0, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__806);
  __Pyx_GIVEREF(__pyx_tuple__806);
  __pyx_codeobj__807 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__806, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_hash, 2984, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__807)) __PYX_ERR(0, 2984, __pyx_L1_error)

  /* "mathics/core/expression.py":2987
 *         return hash(("String", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # hashing a String is the one case where the user gets the untampered
 *         # hash value of the string's text. this corresponds to MMA behavior.
 */
  __pyx_tuple__808 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_update); if (unlikely(!__pyx_tuple__808)) __PYX_ERR(0, 2987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__808);
  __Pyx_GIVEREF(__pyx_tuple__808);
  __pyx_codeobj__809 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__808, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_user_hash, 2987, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__809)) __PYX_ERR(0, 2987, __pyx_L1_error)

  /* "mathics/core/expression.py":2992
 *         update(self.value.encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */
  __pyx_tuple__810 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__810)) __PYX_ERR(0, 2992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__810);
  __Pyx_GIVEREF(__pyx_tuple__810);
  __pyx_codeobj__811 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__810, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_getnewargs, 2992, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__811)) __PYX_ERR(0, 2992, __pyx_L1_error)

  /* "mathics/core/expression.py":2999
 *     value: str
 * 
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if type(value) in (bytes, bytearray):
 */
  __pyx_tuple__812 = PyTuple_Pack(3, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_self); if (unlikely(!__pyx_tuple__812)) __PYX_ERR(0, 2999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__812);
  __Pyx_GIVEREF(__pyx_tuple__812);
  __pyx_codeobj__813 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__812, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 2999, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__813)) __PYX_ERR(0, 2999, __pyx_L1_error)

  /* "mathics/core/expression.py":3011
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return base64.b64encode(self.value).decode("utf8")
 * 
 */
  __pyx_tuple__814 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__814)) __PYX_ERR(0, 3011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__814);
  __Pyx_GIVEREF(__pyx_tuple__814);
  __pyx_codeobj__815 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__814, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_str, 3011, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__815)) __PYX_ERR(0, 3011, __pyx_L1_error)

  /* "mathics/core/expression.py":3014
 *         return base64.b64encode(self.value).decode("utf8")
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return '"' + self.__str__() + '"'
 * 
 */
  __pyx_tuple__816 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_options); if (unlikely(!__pyx_tuple__816)) __PYX_ERR(0, 3014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__816);
  __Pyx_GIVEREF(__pyx_tuple__816);
  __pyx_codeobj__817 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__816, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_text, 3014, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__817)) __PYX_ERR(0, 3014, __pyx_L1_error)

  /* "mathics/core/expression.py":3017
 *         return '"' + self.__str__() + '"'
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return encode_mathml(String('"' + self.__str__() + '"'))
 * 
 */
  __pyx_tuple__818 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_options); if (unlikely(!__pyx_tuple__818)) __PYX_ERR(0, 3017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__818);
  __Pyx_GIVEREF(__pyx_tuple__818);
  __pyx_codeobj__819 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__818, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_mathml, 3017, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__819)) __PYX_ERR(0, 3017, __pyx_L1_error)

  /* "mathics/core/expression.py":3020
 *         return encode_mathml(String('"' + self.__str__() + '"'))
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return encode_tex(String('"' + self.__str__() + '"'))
 * 
 */
  __pyx_tuple__820 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_options); if (unlikely(!__pyx_tuple__820)) __PYX_ERR(0, 3020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__820);
  __Pyx_GIVEREF(__pyx_tuple__820);
  __pyx_codeobj__821 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__820, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_boxes_to_tex, 3020, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__821)) __PYX_ERR(0, 3020, __pyx_L1_error)

  /* "mathics/core/expression.py":3023
 *         return encode_tex(String('"' + self.__str__() + '"'))
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         res = String('""' + self.__str__() + '""')
 *         return res
 */
  __pyx_tuple__822 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_f, __pyx_n_s_evaluation, __pyx_n_s_res); if (unlikely(!__pyx_tuple__822)) __PYX_ERR(0, 3023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__822);
  __Pyx_GIVEREF(__pyx_tuple__822);
  __pyx_codeobj__823 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__822, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_atom_to_boxes, 3023, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__823)) __PYX_ERR(0, 3023, __pyx_L1_error)

  /* "mathics/core/expression.py":3027
 *         return res
 * 
 *     def do_copy(self) -> "ByteArrayAtom":             # <<<<<<<<<<<<<<
 *         return ByteArrayAtom(self.value)
 * 
 */
  __pyx_tuple__824 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__824)) __PYX_ERR(0, 3027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__824);
  __Pyx_GIVEREF(__pyx_tuple__824);
  __pyx_codeobj__825 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__824, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_do_copy, 3027, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__825)) __PYX_ERR(0, 3027, __pyx_L1_error)

  /* "mathics/core/expression.py":3030
 *         return ByteArrayAtom(self.value)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value
 *         return '"' + value.__str__() + '"'
 */
  __pyx_tuple__826 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_evaluation, __pyx_n_s_form, __pyx_n_s_value); if (unlikely(!__pyx_tuple__826)) __PYX_ERR(0, 3030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__826);
  __Pyx_GIVEREF(__pyx_tuple__826);
  __pyx_codeobj__827 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__826, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_default_format, 3030, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__827)) __PYX_ERR(0, 3030, __pyx_L1_error)

  /* "mathics/core/expression.py":3034
 *         return '"' + value.__str__() + '"'
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_tuple__828 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pattern_sort); if (unlikely(!__pyx_tuple__828)) __PYX_ERR(0, 3034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__828);
  __Pyx_GIVEREF(__pyx_tuple__828);
  __pyx_codeobj__829 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__828, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_sort_key, 3034, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__829)) __PYX_ERR(0, 3034, __pyx_L1_error)
  __pyx_tuple__830 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__830)) __PYX_ERR(0, 3034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__830);
  __Pyx_GIVEREF(__pyx_tuple__830);

  /* "mathics/core/expression.py":3040
 *             return [0, 1, self.value, 0, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         # FIX: check
 */
  __pyx_tuple__831 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__831)) __PYX_ERR(0, 3040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__831);
  __Pyx_GIVEREF(__pyx_tuple__831);
  __pyx_codeobj__832 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__831, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_sameQ, 3040, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__832)) __PYX_ERR(0, 3040, __pyx_L1_error)

  /* "mathics/core/expression.py":3047
 *         return False
 * 
 *     def get_string_value(self) -> str:             # <<<<<<<<<<<<<<
 *         try:
 *             return self.value.decode("utf-8")
 */
  __pyx_tuple__833 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__833)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__833);
  __Pyx_GIVEREF(__pyx_tuple__833);
  __pyx_codeobj__834 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__833, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_string_value, 3047, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__834)) __PYX_ERR(0, 3047, __pyx_L1_error)

  /* "mathics/core/expression.py":3053
 *             return None
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_tuple__835 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__835)) __PYX_ERR(0, 3053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__835);
  __Pyx_GIVEREF(__pyx_tuple__835);
  __pyx_codeobj__836 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__835, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_sympy, 3053, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__836)) __PYX_ERR(0, 3053, __pyx_L1_error)

  /* "mathics/core/expression.py":3056
 *         return None
 * 
 *     def to_python(self, *args, **kwargs) -> str:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_tuple__837 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__837)) __PYX_ERR(0, 3056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__837);
  __Pyx_GIVEREF(__pyx_tuple__837);
  __pyx_codeobj__838 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__837, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_to_python, 3056, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__838)) __PYX_ERR(0, 3056, __pyx_L1_error)

  /* "mathics/core/expression.py":3059
 *         return self.value
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("ByteArrayAtom", self.value))
 * 
 */
  __pyx_tuple__839 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__839)) __PYX_ERR(0, 3059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__839);
  __Pyx_GIVEREF(__pyx_tuple__839);
  __pyx_codeobj__840 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__839, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_hash, 3059, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__840)) __PYX_ERR(0, 3059, __pyx_L1_error)

  /* "mathics/core/expression.py":3062
 *         return hash(("ByteArrayAtom", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # hashing a String is the one case where the user gets the untampered
 *         # hash value of the string's text. this corresponds to MMA behavior.
 */
  __pyx_tuple__841 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_update); if (unlikely(!__pyx_tuple__841)) __PYX_ERR(0, 3062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__841);
  __Pyx_GIVEREF(__pyx_tuple__841);
  __pyx_codeobj__842 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__841, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_user_hash, 3062, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__842)) __PYX_ERR(0, 3062, __pyx_L1_error)

  /* "mathics/core/expression.py":3067
 *         update(self.value)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */
  __pyx_tuple__843 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__843)) __PYX_ERR(0, 3067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__843);
  __Pyx_GIVEREF(__pyx_tuple__843);
  __pyx_codeobj__844 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__843, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_getnewargs, 3067, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__844)) __PYX_ERR(0, 3067, __pyx_L1_error)

  /* "mathics/core/expression.py":3072
 * 
 * class StringFromPython(String):
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls, value)
 *         if isinstance(value, sympy.NumberSymbol):
 */
  __pyx_tuple__845 = PyTuple_Pack(3, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_self); if (unlikely(!__pyx_tuple__845)) __PYX_ERR(0, 3072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__845);
  __Pyx_GIVEREF(__pyx_tuple__845);
  __pyx_codeobj__846 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__845, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_new_2, 3072, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__846)) __PYX_ERR(0, 3072, __pyx_L1_error)

  /* "mathics/core/expression.py":3084
 * 
 * 
 * def get_default_value(name, evaluation, k=None, n=None):             # <<<<<<<<<<<<<<
 *     pos = []
 *     if k is not None:
 */
  __pyx_tuple__847 = PyTuple_Pack(9, __pyx_n_s_name, __pyx_n_s_evaluation, __pyx_n_s_k, __pyx_n_s_n, __pyx_n_s_pos_2, __pyx_n_s_pos_len, __pyx_n_s_defaultexpr, __pyx_n_s_result, __pyx_n_s_index); if (unlikely(!__pyx_tuple__847)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__847);
  __Pyx_GIVEREF(__pyx_tuple__847);
  __pyx_codeobj__848 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__847, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_get_default_value, 3084, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__848)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __pyx_tuple__849 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__849)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__849);
  __Pyx_GIVEREF(__pyx_tuple__849);

  /* "mathics/core/expression.py":3105
 * 
 * 
 * def print_parenthesizes(             # <<<<<<<<<<<<<<
 *     precedence, outer_precedence=None, parenthesize_when_equal=False
 * ) -> bool:
 */
  __pyx_tuple__850 = PyTuple_Pack(3, __pyx_n_s_precedence, __pyx_n_s_outer_precedence, __pyx_n_s_parenthesize_when_equal); if (unlikely(!__pyx_tuple__850)) __PYX_ERR(0, 3105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__850);
  __Pyx_GIVEREF(__pyx_tuple__850);
  __pyx_codeobj__851 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__850, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_print_parenthesizes, 3105, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__851)) __PYX_ERR(0, 3105, __pyx_L1_error)
  __pyx_tuple__852 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__852)) __PYX_ERR(0, 3105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__852);
  __Pyx_GIVEREF(__pyx_tuple__852);

  /* "mathics/core/expression.py":3114
 * 
 * 
 * def _is_neutral_symbol(symbol_name, cache, evaluation):             # <<<<<<<<<<<<<<
 *     # a symbol is neutral if it does not invoke any rules, but is sure to make its Expression stay
 *     # the way it is (e.g. List[1, 2, 3] will always stay List[1, 2, 3], so long as nobody defines
 */
  __pyx_tuple__853 = PyTuple_Pack(8, __pyx_n_s_symbol_name, __pyx_n_s_cache_2, __pyx_n_s_evaluation, __pyx_n_s_r, __pyx_n_s_definitions, __pyx_n_s_definition, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__853)) __PYX_ERR(0, 3114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__853);
  __Pyx_GIVEREF(__pyx_tuple__853);
  __pyx_codeobj__854 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__853, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_neutral_symbol, 3114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__854)) __PYX_ERR(0, 3114, __pyx_L1_error)

  /* "mathics/core/expression.py":3141
 * 
 * 
 * def _is_neutral_head(head, cache, evaluation):             # <<<<<<<<<<<<<<
 *     if not isinstance(head, Symbol):
 *         return False
 */
  __pyx_tuple__855 = PyTuple_Pack(3, __pyx_n_s_head, __pyx_n_s_cache_2, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__855)) __PYX_ERR(0, 3141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__855);
  __Pyx_GIVEREF(__pyx_tuple__855);
  __pyx_codeobj__856 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__855, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_is_neutral_head, 3141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__856)) __PYX_ERR(0, 3141, __pyx_L1_error)

  /* "mathics/core/expression.py":3155
 * 
 * 
 * class Structure(object):             # <<<<<<<<<<<<<<
 *     def __call__(self, leaves):
 *         # create an Expression with the given list "leaves" as leaves.
 */
  __pyx_tuple__857 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__857)) __PYX_ERR(0, 3155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__857);
  __Pyx_GIVEREF(__pyx_tuple__857);

  /* "mathics/core/expression.py":3156
 * 
 * class Structure(object):
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         # create an Expression with the given list "leaves" as leaves.
 *         # NOTE: the caller guarantees that "leaves" only contains items that are from "origins".
 */
  __pyx_tuple__858 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_leaves); if (unlikely(!__pyx_tuple__858)) __PYX_ERR(0, 3156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__858);
  __Pyx_GIVEREF(__pyx_tuple__858);
  __pyx_codeobj__859 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__858, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_call, 3156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__859)) __PYX_ERR(0, 3156, __pyx_L1_error)

  /* "mathics/core/expression.py":3161
 *         raise NotImplementedError
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         # create an Expression with a subset of "expr".leaves (picked out by the filter "cond").
 *         # NOTE: the caller guarantees that "expr" is from "origins".
 */
  __pyx_tuple__860 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_cond); if (unlikely(!__pyx_tuple__860)) __PYX_ERR(0, 3161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__860);
  __Pyx_GIVEREF(__pyx_tuple__860);
  __pyx_codeobj__861 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__860, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_filter, 3161, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__861)) __PYX_ERR(0, 3161, __pyx_L1_error)

  /* "mathics/core/expression.py":3166
 *         raise NotImplementedError
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         # create an Expression, using the given slice of "expr".leaves as leaves.
 *         # NOTE: the caller guarantees that "expr" is from "origins".
 */
  __pyx_tuple__862 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_py_slice); if (unlikely(!__pyx_tuple__862)) __PYX_ERR(0, 3166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__862);
  __Pyx_GIVEREF(__pyx_tuple__862);
  __pyx_codeobj__863 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__862, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_slice, 3166, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__863)) __PYX_ERR(0, 3166, __pyx_L1_error)

  /* "mathics/core/expression.py":3177
 * 
 * class UnlinkedStructure(Structure):
 *     def __init__(self, head):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = None
 */
  __pyx_tuple__864 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_head); if (unlikely(!__pyx_tuple__864)) __PYX_ERR(0, 3177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__864);
  __Pyx_GIVEREF(__pyx_tuple__864);
  __pyx_codeobj__865 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__864, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_init, 3177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__865)) __PYX_ERR(0, 3177, __pyx_L1_error)

  /* "mathics/core/expression.py":3181
 *         self._cache = None
 * 
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)
 */
  __pyx_tuple__866 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_leaves, __pyx_n_s_expr); if (unlikely(!__pyx_tuple__866)) __PYX_ERR(0, 3181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__866);
  __Pyx_GIVEREF(__pyx_tuple__866);
  __pyx_codeobj__867 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__866, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_call, 3181, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__867)) __PYX_ERR(0, 3181, __pyx_L1_error)

  /* "mathics/core/expression.py":3186
 *         return expr
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 */
  __pyx_tuple__868 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_cond, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__868)) __PYX_ERR(0, 3186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__868);
  __Pyx_GIVEREF(__pyx_tuple__868);
  __pyx_codeobj__869 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__868, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_filter, 3186, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__869)) __PYX_ERR(0, 3186, __pyx_L1_error)

  /* "mathics/core/expression.py":3189
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 */
  __pyx_tuple__870 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_py_slice, __pyx_n_s_leaves, __pyx_n_s_lower, __pyx_n_s_upper, __pyx_n_s_step); if (unlikely(!__pyx_tuple__870)) __PYX_ERR(0, 3189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__870);
  __Pyx_GIVEREF(__pyx_tuple__870);
  __pyx_codeobj__871 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__870, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_slice, 3189, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__871)) __PYX_ERR(0, 3189, __pyx_L1_error)

  /* "mathics/core/expression.py":3203
 * 
 * class LinkedStructure(Structure):
 *     def __init__(self, head, cache):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = cache
 */
  __pyx_tuple__872 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_head, __pyx_n_s_cache_2); if (unlikely(!__pyx_tuple__872)) __PYX_ERR(0, 3203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__872);
  __Pyx_GIVEREF(__pyx_tuple__872);
  __pyx_codeobj__873 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__872, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_init, 3203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__873)) __PYX_ERR(0, 3203, __pyx_L1_error)

  /* "mathics/core/expression.py":3207
 *         self._cache = cache
 * 
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)
 */
  __pyx_tuple__874 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_leaves, __pyx_n_s_expr); if (unlikely(!__pyx_tuple__874)) __PYX_ERR(0, 3207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__874);
  __Pyx_GIVEREF(__pyx_tuple__874);
  __pyx_codeobj__875 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__874, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_call, 3207, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__875)) __PYX_ERR(0, 3207, __pyx_L1_error)

  /* "mathics/core/expression.py":3213
 *         return expr
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 */
  __pyx_tuple__876 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_cond, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__876)) __PYX_ERR(0, 3213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__876);
  __Pyx_GIVEREF(__pyx_tuple__876);
  __pyx_codeobj__877 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__876, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_filter, 3213, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__877)) __PYX_ERR(0, 3213, __pyx_L1_error)

  /* "mathics/core/expression.py":3216
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 */
  __pyx_tuple__878 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_py_slice, __pyx_n_s_leaves, __pyx_n_s_lower, __pyx_n_s_upper, __pyx_n_s_step, __pyx_n_s_new); if (unlikely(!__pyx_tuple__878)) __PYX_ERR(0, 3216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__878);
  __Pyx_GIVEREF(__pyx_tuple__878);
  __pyx_codeobj__879 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__878, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_slice, 3216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__879)) __PYX_ERR(0, 3216, __pyx_L1_error)

  /* "mathics/core/expression.py":3230
 * 
 * 
 * def structure(head, origins, evaluation, structure_cache=None):             # <<<<<<<<<<<<<<
 *     # creates a Structure for building Expressions with head "head" and leaves
 *     # originating (exlusively) from "origins" (leaves are passed into the functions
 */
  __pyx_tuple__880 = PyTuple_Pack(5, __pyx_n_s_head, __pyx_n_s_origins, __pyx_n_s_evaluation, __pyx_n_s_structure_cache, __pyx_n_s_cache_2); if (unlikely(!__pyx_tuple__880)) __PYX_ERR(0, 3230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__880);
  __Pyx_GIVEREF(__pyx_tuple__880);
  __pyx_codeobj__881 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__880, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_structure, 3230, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__881)) __PYX_ERR(0, 3230, __pyx_L1_error)
  __pyx_tuple__882 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__882)) __PYX_ERR(0, 3230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__882);
  __Pyx_GIVEREF(__pyx_tuple__882);

  /* "mathics/core/expression.py":3263
 * 
 * 
 * def atom_list_constructor(evaluation, head, *atom_names):             # <<<<<<<<<<<<<<
 *     # if we encounter an Expression that consists wholly of atoms and those atoms (and the
 *     # expression's head) have no rules associated with them, we can speed up evaluation.
 */
  __pyx_tuple__883 = PyTuple_Pack(12, __pyx_n_s_evaluation, __pyx_n_s_head, __pyx_n_s_atom_names, __pyx_n_s_optimize, __pyx_n_s_full_atom_names, __pyx_n_s_construct, __pyx_n_s_construct, __pyx_n_s_construct, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_atom, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__883)) __PYX_ERR(0, 3263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__883);
  __Pyx_GIVEREF(__pyx_tuple__883);
  __pyx_codeobj__884 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__883, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_atom_list_constructor, 3263, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__884)) __PYX_ERR(0, 3263, __pyx_L1_error)

  /* "mathics/core/expression.py":3303
 * 
 * 
 * def string_list(head, leaves, evaluation):             # <<<<<<<<<<<<<<
 *     return atom_list_constructor(evaluation, head, "String")(leaves)
 */
  __pyx_tuple__885 = PyTuple_Pack(3, __pyx_n_s_head, __pyx_n_s_leaves, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__885)) __PYX_ERR(0, 3303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__885);
  __Pyx_GIVEREF(__pyx_tuple__885);
  __pyx_codeobj__886 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__885, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_core_expression_py, __pyx_n_s_string_list, 3303, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__886)) __PYX_ERR(0, 3303, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_update.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PySet_Type_intersection.type = (PyObject*)&PySet_Type;
  __pyx_umethod_PySet_Type_update.type = (PyObject*)&PySet_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1eneg_10 = PyFloat_FromDouble(1e-10); if (unlikely(!__pyx_float_1eneg_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_7 = PyInt_FromLong(7); if (unlikely(!__pyx_int_7)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_40 = PyInt_FromLong(40); if (unlikely(!__pyx_int_40)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_170 = PyInt_FromLong(170); if (unlikely(!__pyx_int_170)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_5 = PyInt_FromLong(-5); if (unlikely(!__pyx_int_neg_5)) __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_9genexpr40__pyx_v_7mathics_4core_10expression_c = Py_None; Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct__sliced) < 0) __PYX_ERR(0, 208, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct__sliced.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct__sliced.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct__sliced.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct__sliced.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct__sliced = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct__sliced;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 217, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_1_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_1_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_2_do_format) < 0) __PYX_ERR(0, 404, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_2_do_format.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_2_do_format.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_2_do_format.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_2_do_format.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_2_do_format = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_2_do_format;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_3___cmp) < 0) __PYX_ERR(0, 657, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_3___cmp.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_3___cmp.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_3___cmp.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_3___cmp.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_3___cmp = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_3___cmp;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_4_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_4_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_4_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_4_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_4_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_4_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 670, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_5_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_5_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_5_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_5_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_5_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_5_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_6___new__) < 0) __PYX_ERR(0, 714, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_6___new__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_6___new__.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_6___new__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_6___new__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_6___new__ = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_6___new__;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_7_genexpr) < 0) __PYX_ERR(0, 719, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_7_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_7_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_7_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_7_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_7_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_7_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence) < 0) __PYX_ERR(0, 843, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_8_flatten_pattern_sequence;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_9_copy) < 0) __PYX_ERR(0, 903, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_9_copy.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_9_copy.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_9_copy.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_9_copy.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_9_copy = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_9_copy;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_10_genexpr) < 0) __PYX_ERR(0, 905, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_10_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_10_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_10_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_10_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_10_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_10_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes) < 0) __PYX_ERR(0, 974, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_11_get_attributes;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_12_genexpr) < 0) __PYX_ERR(0, 980, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_12_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_12_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_12_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_12_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_12_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_12_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol) < 0) __PYX_ERR(0, 1017, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_13_has_symbol;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_14_genexpr) < 0) __PYX_ERR(0, 1021, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_14_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_14_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_14_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_14_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_14_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_14_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key) < 0) __PYX_ERR(0, 1110, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_15_get_sort_key;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_16_genexpr) < 0) __PYX_ERR(0, 1147, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_16_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_16_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_16_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_16_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_16_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_16_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_17_genexpr) < 0) __PYX_ERR(0, 1205, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_17_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_17_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_17_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_17_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_17_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_17_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_18_evaluate_next;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_19_rules) < 0) __PYX_ERR(0, 1430, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_19_rules.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_19_rules.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_19_rules.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_19_rules.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_19_rules = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_19_rules;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior) < 0) __PYX_ERR(0, 1546, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_20_is_list_interior;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_21_genexpr) < 0) __PYX_ERR(0, 1548, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_21_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_21_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_21_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_21_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_21_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_21_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules) < 0) __PYX_ERR(0, 1687, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_22_apply_rules;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars) < 0) __PYX_ERR(0, 1726, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_23_replace_vars;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_24_genexpr) < 0) __PYX_ERR(0, 1739, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_24_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_24_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_24_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_24_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_24_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_24_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric) < 0) __PYX_ERR(0, 1838, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_25_is_numeric;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_26_genexpr) < 0) __PYX_ERR(0, 1852, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_26_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_26_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_26_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_26_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_26_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_26_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars) < 0) __PYX_ERR(0, 2067, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_27_replace_vars;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_28_genexpr) < 0) __PYX_ERR(0, 2068, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_28_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_28_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_28_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_28_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_28_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_28_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex) < 0) __PYX_ERR(0, 2786, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_29_encode_tex;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol) < 0) __PYX_ERR(0, 3114, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_30__is_neutral_symbol;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_31_genexpr) < 0) __PYX_ERR(0, 3131, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_31_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_31_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_31_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_31_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_31_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_31_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor) < 0) __PYX_ERR(0, 3263, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_32_atom_list_constructor;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_33_genexpr) < 0) __PYX_ERR(0, 3271, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_33_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_33_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_33_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_33_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_33_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_33_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_4core_10expression___pyx_scope_struct_34_genexpr) < 0) __PYX_ERR(0, 3278, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_4core_10expression___pyx_scope_struct_34_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_4core_10expression___pyx_scope_struct_34_genexpr.tp_dictoffset && __pyx_type_7mathics_4core_10expression___pyx_scope_struct_34_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_4core_10expression___pyx_scope_struct_34_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_4core_10expression___pyx_scope_struct_34_genexpr = &__pyx_type_7mathics_4core_10expression___pyx_scope_struct_34_genexpr;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initexpression(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initexpression(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_expression(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_expression(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_expression(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  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 'expression' 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_expression(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("expression", __pyx_methods, 0, 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_mathics__core__expression) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "mathics.core.expression")) {
      if (unlikely(PyDict_SetItemString(modules, "mathics.core.expression", __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)
  (void)__Pyx_modinit_type_import_code();
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "mathics/core/expression.py":4
 * # -*- coding: utf-8 -*-
 * 
 * import sympy             # <<<<<<<<<<<<<<
 * import mpmath
 * import math
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sympy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sympy, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":5
 * 
 * import sympy
 * import mpmath             # <<<<<<<<<<<<<<
 * import math
 * import re
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_mpmath, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mpmath, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":6
 * import sympy
 * import mpmath
 * import math             # <<<<<<<<<<<<<<
 * import re
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":7
 * import mpmath
 * import math
 * import re             # <<<<<<<<<<<<<<
 * 
 * import typing
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_re, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":9
 * import re
 * 
 * import typing             # <<<<<<<<<<<<<<
 * from typing import Any, Optional
 * from itertools import chain
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_typing, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_typing, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":10
 * 
 * import typing
 * from typing import Any, Optional             # <<<<<<<<<<<<<<
 * from itertools import chain
 * from bisect import bisect_left
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Any);
  __Pyx_GIVEREF(__pyx_n_s_Any);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Any);
  __Pyx_INCREF(__pyx_n_s_Optional);
  __Pyx_GIVEREF(__pyx_n_s_Optional);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_Optional);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __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_Any); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Any, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Optional); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Optional, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":11
 * import typing
 * from typing import Any, Optional
 * from itertools import chain             # <<<<<<<<<<<<<<
 * from bisect import bisect_left
 * from functools import lru_cache
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_chain);
  __Pyx_GIVEREF(__pyx_n_s_chain);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_chain);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_itertools, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __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_chain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_chain, __pyx_t_2) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":12
 * from typing import Any, Optional
 * from itertools import chain
 * from bisect import bisect_left             # <<<<<<<<<<<<<<
 * from functools import lru_cache
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_bisect_left);
  __Pyx_GIVEREF(__pyx_n_s_bisect_left);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_bisect_left);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_bisect, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __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_bisect_left); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_bisect_left, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":13
 * from itertools import chain
 * from bisect import bisect_left
 * from functools import lru_cache             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_lru_cache);
  __Pyx_GIVEREF(__pyx_n_s_lru_cache);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_lru_cache);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_functools, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __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_lru_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_lru_cache, __pyx_t_2) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":16
 * 
 * 
 * from mathics.core.numbers import get_type, dps, prec, min_prec, machine_precision             # <<<<<<<<<<<<<<
 * from mathics.core.convert import sympy_symbol_prefix, SympyExpression
 * import base64
 */
  __pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_get_type);
  __Pyx_GIVEREF(__pyx_n_s_get_type);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_type);
  __Pyx_INCREF(__pyx_n_s_dps);
  __Pyx_GIVEREF(__pyx_n_s_dps);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_dps);
  __Pyx_INCREF(__pyx_n_s_prec);
  __Pyx_GIVEREF(__pyx_n_s_prec);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_prec);
  __Pyx_INCREF(__pyx_n_s_min_prec);
  __Pyx_GIVEREF(__pyx_n_s_min_prec);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_min_prec);
  __Pyx_INCREF(__pyx_n_s_machine_precision);
  __Pyx_GIVEREF(__pyx_n_s_machine_precision);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_machine_precision);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_core_numbers, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __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_get_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_type, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_dps, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_prec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_prec, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_min_prec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_min_prec, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_machine_precision); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_machine_precision, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":17
 * 
 * from mathics.core.numbers import get_type, dps, prec, min_prec, machine_precision
 * from mathics.core.convert import sympy_symbol_prefix, SympyExpression             # <<<<<<<<<<<<<<
 * import base64
 * 
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_sympy_symbol_prefix);
  __Pyx_GIVEREF(__pyx_n_s_sympy_symbol_prefix);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_sympy_symbol_prefix);
  __Pyx_INCREF(__pyx_n_s_SympyExpression);
  __Pyx_GIVEREF(__pyx_n_s_SympyExpression);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_SympyExpression);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_mathics_core_convert, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __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_sympy_symbol_prefix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sympy_symbol_prefix, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SympyExpression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SympyExpression, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":18
 * from mathics.core.numbers import get_type, dps, prec, min_prec, machine_precision
 * from mathics.core.convert import sympy_symbol_prefix, SympyExpression
 * import base64             # <<<<<<<<<<<<<<
 * 
 * # Imperical number that seems to work.
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_base64, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_base64, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":22
 * # Imperical number that seems to work.
 * # We have to be able to match mpmath values with sympy values
 * COMPARE_PREC = 50             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_COMPARE_PREC, __pyx_int_50) < 0) __PYX_ERR(0, 22, __pyx_L1_error)

  /* "mathics/core/expression.py":25
 * 
 * 
 * def fully_qualified_symbol_name(name) -> bool:             # <<<<<<<<<<<<<<
 *     return (
 *         isinstance(name, str)
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_1fully_qualified_symbol_name, 0, __pyx_n_s_fully_qualified_symbol_name, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__120)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fully_qualified_symbol_name, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":35
 * 
 * 
 * def valid_context_name(ctx, allow_initial_backquote=False) -> bool:             # <<<<<<<<<<<<<<
 *     return (
 *         isinstance(ctx, str)
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_3valid_context_name, 0, __pyx_n_s_valid_context_name, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__122)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__123);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_valid_context_name, __pyx_t_1) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":44
 * 
 * 
 * def ensure_context(name, context="System`") -> str:             # <<<<<<<<<<<<<<
 *     assert isinstance(name, str)
 *     assert name != ""
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_5ensure_context, 0, __pyx_n_s_ensure_context, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__125)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__126);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ensure_context, __pyx_t_2) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":57
 * 
 * 
 * def strip_context(name) -> str:             # <<<<<<<<<<<<<<
 *     if "`" in name:
 *         return name[name.rindex("`") + 1 :]
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7strip_context, 0, __pyx_n_s_strip_context, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__128)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strip_context, __pyx_t_1) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":64
 * 
 * # system_symbols('A', 'B', ...) -> ['System`A', 'System`B', ...]
 * def system_symbols(*symbols) -> typing.List[str]:             # <<<<<<<<<<<<<<
 *     return [ensure_context(s) for s in symbols]
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_typing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_List); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_3, ((PyObject *)(&PyUnicode_Type))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_9system_symbols, 0, __pyx_n_s_system_symbols, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__130)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_system_symbols, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":69
 * 
 * # system_symbols_dict({'SomeSymbol': ...}) -> {'System`SomeSymbol': ...}
 * def system_symbols_dict(d):             # <<<<<<<<<<<<<<
 *     return {ensure_context(k): v for k, v in d.items()}
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11system_symbols_dict, 0, __pyx_n_s_system_symbols_dict, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__132)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_system_symbols_dict, __pyx_t_2) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":73
 * 
 * 
 * class BoxError(Exception):             # <<<<<<<<<<<<<<
 *     def __init__(self, box, form) -> None:
 *         super().__init__("Box %s cannot be formatted as %s" % (box, form))
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_BoxError, __pyx_n_s_BoxError, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "mathics/core/expression.py":74
 * 
 * class BoxError(Exception):
 *     def __init__(self, box, form) -> None:             # <<<<<<<<<<<<<<
 *         super().__init__("Box %s cannot be formatted as %s" % (box, form))
 *         self.box = box
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, Py_None) < 0) __PYX_ERR(0, 74, __pyx_L1_error)
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8BoxError_1__init__, 0, __pyx_n_s_BoxError___init, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__134)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_t_6);
  PyList_Append(__pyx_t_4, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":73
 * 
 * 
 * class BoxError(Exception):             # <<<<<<<<<<<<<<
 *     def __init__(self, box, form) -> None:
 *         super().__init__("Box %s cannot be formatted as %s" % (box, form))
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_BoxError, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BoxError, __pyx_t_6) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":80
 * 
 * 
 * class ExpressionPointer(object):             # <<<<<<<<<<<<<<
 *     def __init__(self, parent, position) -> None:
 *         self.parent = parent
 */
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__135); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__135, __pyx_n_s_ExpressionPointer, __pyx_n_s_ExpressionPointer, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "mathics/core/expression.py":81
 * 
 * class ExpressionPointer(object):
 *     def __init__(self, parent, position) -> None:             # <<<<<<<<<<<<<<
 *         self.parent = parent
 *         self.position = position
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, Py_None) < 0) __PYX_ERR(0, 81, __pyx_L1_error)
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_17ExpressionPointer_1__init__, 0, __pyx_n_s_ExpressionPointer___init, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__137)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 81, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":85
 *         self.position = position
 * 
 *     def replace(self, new) -> None:             # <<<<<<<<<<<<<<
 *         if self.position == 0:
 *             self.parent.set_head(new)
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, Py_None) < 0) __PYX_ERR(0, 85, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_17ExpressionPointer_3replace, 0, __pyx_n_s_ExpressionPointer_replace, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__139)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_replace, __pyx_t_3) < 0) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":91
 *             self.parent.set_leaf(self.position - 1, new)
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[[%s]]" % (self.parent, self.position)
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_17ExpressionPointer_5__str__, 0, __pyx_n_s_ExpressionPointer___str, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__141)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_str, __pyx_t_6) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":80
 * 
 * 
 * class ExpressionPointer(object):             # <<<<<<<<<<<<<<
 *     def __init__(self, parent, position) -> None:
 *         self.parent = parent
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_ExpressionPointer, __pyx_tuple__135, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ExpressionPointer, __pyx_t_6) < 0) __PYX_ERR(0, 80, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":95
 * 
 * 
 * def from_python(arg):             # <<<<<<<<<<<<<<
 *     """Converts a Python expression into a Mathics expression.
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13from_python, 0, __pyx_n_s_from_python, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__143)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_from_python, __pyx_t_2) < 0) __PYX_ERR(0, 95, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":153
 * 
 * 
 * class KeyComparable(object):             # <<<<<<<<<<<<<<
 *     def get_sort_key(self):
 *         raise NotImplementedError
 */
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__144); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__144, __pyx_n_s_KeyComparable, __pyx_n_s_KeyComparable, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "mathics/core/expression.py":154
 * 
 * class KeyComparable(object):
 *     def get_sort_key(self):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13KeyComparable_1get_sort_key, 0, __pyx_n_s_KeyComparable_get_sort_key, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__146)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_sort_key, __pyx_t_6) < 0) __PYX_ERR(0, 154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":157
 *         raise NotImplementedError
 * 
 *     def __lt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() < other.get_sort_key()
 * 
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13KeyComparable_3__lt__, 0, __pyx_n_s_KeyComparable___lt, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__148)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_lt_2, __pyx_t_3) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":160
 *         return self.get_sort_key() < other.get_sort_key()
 * 
 *     def __gt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() > other.get_sort_key()
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 160, __pyx_L1_error)
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13KeyComparable_5__gt__, 0, __pyx_n_s_KeyComparable___gt, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__150)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_gt_2, __pyx_t_6) < 0) __PYX_ERR(0, 160, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":163
 *         return self.get_sort_key() > other.get_sort_key()
 * 
 *     def __le__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() <= other.get_sort_key()
 * 
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13KeyComparable_7__le__, 0, __pyx_n_s_KeyComparable___le, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__152)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_le, __pyx_t_3) < 0) __PYX_ERR(0, 163, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":166
 *         return self.get_sort_key() <= other.get_sort_key()
 * 
 *     def __ge__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_sort_key() >= other.get_sort_key()
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 166, __pyx_L1_error)
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13KeyComparable_9__ge__, 0, __pyx_n_s_KeyComparable___ge, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__154)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_ge, __pyx_t_6) < 0) __PYX_ERR(0, 166, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":169
 *         return self.get_sort_key() >= other.get_sort_key()
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             hasattr(other, "get_sort_key")
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13KeyComparable_11__eq__, 0, __pyx_n_s_KeyComparable___eq, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__156)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_6);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_eq, __pyx_t_3) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":175
 *         )
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             not hasattr(other, "get_sort_key")
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 175, __pyx_L1_error)
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13KeyComparable_13__ne__, 0, __pyx_n_s_KeyComparable___ne, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__158)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_ne, __pyx_t_6) < 0) __PYX_ERR(0, 175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":153
 * 
 * 
 * class KeyComparable(object):             # <<<<<<<<<<<<<<
 *     def get_sort_key(self):
 *         raise NotImplementedError
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_KeyComparable, __pyx_tuple__144, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_KeyComparable, __pyx_t_6) < 0) __PYX_ERR(0, 153, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":195
 * 
 * 
 * class ExpressionCache:             # <<<<<<<<<<<<<<
 *     def __init__(self, time=None, symbols=None, sequences=None, copy=None):
 *         if copy is not None:
 */
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_ExpressionCache, __pyx_n_s_ExpressionCache, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "mathics/core/expression.py":196
 * 
 * class ExpressionCache:
 *     def __init__(self, time=None, symbols=None, sequences=None, copy=None):             # <<<<<<<<<<<<<<
 *         if copy is not None:
 *             time = time or copy.time
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_15ExpressionCache_1__init__, 0, __pyx_n_s_ExpressionCache___init, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__160)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__161);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":205
 *         self.sequences = sequences
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return ExpressionCache(self.time, self.symbols, self.sequences)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_15ExpressionCache_3copy, 0, __pyx_n_s_ExpressionCache_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__163)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_copy, __pyx_t_1) < 0) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":208
 *         return ExpressionCache(self.time, self.symbols, self.sequences)
 * 
 *     def sliced(self, lower, upper):             # <<<<<<<<<<<<<<
 *         # indicates that the Expression's leaves have been slices with
 *         # the given indices.
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_15ExpressionCache_5sliced, 0, __pyx_n_s_ExpressionCache_sliced, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__165)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_sliced, __pyx_t_1) < 0) __PYX_ERR(0, 208, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":225
 *         return ExpressionCache(self.time, self.symbols, new_sequences)
 * 
 *     def reordered(self):             # <<<<<<<<<<<<<<
 *         # indicates that the Expression's leaves have been reordered
 *         # or reduced (i.e. that the leaves have changed, but that
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_15ExpressionCache_7reordered, 0, __pyx_n_s_ExpressionCache_reordered, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__167)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_reordered, __pyx_t_1) < 0) __PYX_ERR(0, 225, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":240
 * 
 *     @staticmethod
 *     def union(expressions, evaluation):             # <<<<<<<<<<<<<<
 *         definitions = evaluation.definitions
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_15ExpressionCache_9union, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_ExpressionCache_union, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__169)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "mathics/core/expression.py":239
 *         return ExpressionCache(None, self.symbols, sequences)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def union(expressions, evaluation):
 *         definitions = evaluation.definitions
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_union, __pyx_t_6) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":195
 * 
 * 
 * class ExpressionCache:             # <<<<<<<<<<<<<<
 *     def __init__(self, time=None, symbols=None, sequences=None, copy=None):
 *         if copy is not None:
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_ExpressionCache, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ExpressionCache, __pyx_t_6) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":254
 * 
 * 
 * class BaseExpression(KeyComparable):             # <<<<<<<<<<<<<<
 *     options: Any
 *     pattern_sequence: bool
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_KeyComparable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_6, __pyx_n_s_BaseExpression, __pyx_n_s_BaseExpression, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "mathics/core/expression.py":260
 *     last_evaluated: Any
 * 
 *     def __new__(cls, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self = object.__new__(cls)
 *         self.options = None
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_BaseExpression___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__171)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_new_2, __pyx_t_3) < 0) __PYX_ERR(0, 260, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":268
 *         return self
 * 
 *     def clear_cache(self):             # <<<<<<<<<<<<<<
 *         self._cache = None
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_3clear_cache, 0, __pyx_n_s_BaseExpression_clear_cache, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__173)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_clear_cache, __pyx_t_3) < 0) __PYX_ERR(0, 268, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":271
 *         self._cache = None
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Any); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_rhs, __pyx_t_4) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Optional); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, ((PyObject*)&PyBool_Type)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_5equal2, 0, __pyx_n_s_BaseExpression_equal2, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__175)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_equal2, __pyx_t_5) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":286
 *         return None
 * 
 *     def has_changed(self, definitions):             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_7has_changed, 0, __pyx_n_s_BaseExpression_has_changed, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__177)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_has_changed, __pyx_t_5) < 0) __PYX_ERR(0, 286, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":289
 *         return True
 * 
 *     def sequences(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_9sequences, 0, __pyx_n_s_BaseExpression_sequences, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__179)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_sequences, __pyx_t_5) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":292
 *         return None
 * 
 *     def flatten_sequence(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_BaseExpression) < 0) __PYX_ERR(0, 292, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_11flatten_sequence, 0, __pyx_n_s_BaseExpression_flatten_sequence, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__181)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_flatten_sequence_2, __pyx_t_3) < 0) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":295
 *         return self
 * 
 *     def flatten_pattern_sequence(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_BaseExpression) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_13flatten_pattern_sequence, 0, __pyx_n_s_BaseExpression_flatten_pattern_s, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__183)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_flatten_pattern_sequence, __pyx_t_5) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":298
 *         return self
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         return set()
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_15get_attributes, 0, __pyx_n_s_BaseExpression_get_attributes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__185)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_attributes, __pyx_t_5) < 0) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":301
 *         return set()
 * 
 *     def evaluate_next(self, evaluation):             # <<<<<<<<<<<<<<
 *         return self.evaluate(evaluation), False
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_17evaluate_next, 0, __pyx_n_s_BaseExpression_evaluate_next, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__187)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate_next, __pyx_t_5) < 0) __PYX_ERR(0, 301, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":304
 *         return self.evaluate(evaluation), False
 * 
 *     def evaluate(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_BaseExpression) < 0) __PYX_ERR(0, 304, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_19evaluate, 0, __pyx_n_s_BaseExpression_evaluate, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__189)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate, __pyx_t_3) < 0) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":308
 *         return self
 * 
 *     def get_atoms(self, include_heads=True):             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_21get_atoms, 0, __pyx_n_s_BaseExpression_get_atoms, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__191)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__192);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_atoms, __pyx_t_3) < 0) __PYX_ERR(0, 308, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":311
 *         return []
 * 
 *     def get_name(self):             # <<<<<<<<<<<<<<
 *         "Returns symbol's name if Symbol instance"
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_23get_name, 0, __pyx_n_s_BaseExpression_get_name, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__194)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_name, __pyx_t_3) < 0) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":316
 *         return ""
 * 
 *     def is_symbol(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_25is_symbol, 0, __pyx_n_s_BaseExpression_is_symbol, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__196)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_is_symbol, __pyx_t_5) < 0) __PYX_ERR(0, 316, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":319
 *         return False
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 319, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_27is_machine_precision, 0, __pyx_n_s_BaseExpression_is_machine_precis, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__198)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_is_machine_precision, __pyx_t_3) < 0) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":322
 *         return False
 * 
 *     def get_lookup_name(self):             # <<<<<<<<<<<<<<
 *         "Returns symbol name of leftmost head"
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_29get_lookup_name, 0, __pyx_n_s_BaseExpression_get_lookup_name, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__200)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_lookup_name, __pyx_t_3) < 0) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":327
 *         return self.get_name()
 * 
 *     def get_head(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_31get_head, 0, __pyx_n_s_BaseExpression_get_head, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__202)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_head, __pyx_t_3) < 0) __PYX_ERR(0, 327, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":330
 *         return None
 * 
 *     def get_head_name(self):             # <<<<<<<<<<<<<<
 *         return self.get_head().get_name()
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_33get_head_name, 0, __pyx_n_s_BaseExpression_get_head_name, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__204)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_head_name, __pyx_t_3) < 0) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":333
 *         return self.get_head().get_name()
 * 
 *     def get_leaves(self):             # <<<<<<<<<<<<<<
 *         return []
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_35get_leaves, 0, __pyx_n_s_BaseExpression_get_leaves, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__206)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_leaves, __pyx_t_3) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":336
 *         return []
 * 
 *     def get_int_value(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_37get_int_value, 0, __pyx_n_s_BaseExpression_get_int_value, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__208)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_int_value, __pyx_t_3) < 0) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":339
 *         return None
 * 
 *     def get_float_value(self, permit_complex=False):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_39get_float_value, 0, __pyx_n_s_BaseExpression_get_float_value, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__210)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__211);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_float_value, __pyx_t_3) < 0) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":342
 *         return None
 * 
 *     def get_string_value(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_41get_string_value, 0, __pyx_n_s_BaseExpression_get_string_value, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__213)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_string_value, __pyx_t_3) < 0) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":345
 *         return None
 * 
 *     def is_atom(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 345, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_43is_atom, 0, __pyx_n_s_BaseExpression_is_atom, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__215)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_is_atom, __pyx_t_5) < 0) __PYX_ERR(0, 345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":348
 *         return False
 * 
 *     def is_true(self) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 348, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_45is_true, 0, __pyx_n_s_BaseExpression_is_true, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__217)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_is_true, __pyx_t_3) < 0) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":351
 *         return False
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         # used by NumericQ and expression ordering
 *         return False
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 351, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_47is_numeric, 0, __pyx_n_s_BaseExpression_is_numeric, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__219)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_is_numeric, __pyx_t_5) < 0) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":355
 *         return False
 * 
 *     def has_form(self, heads, *leaf_counts):             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_49has_form, 0, __pyx_n_s_BaseExpression_has_form, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__221)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_has_form, __pyx_t_5) < 0) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":358
 *         return False
 * 
 *     def flatten(self, head, pattern_only=False, callback=None) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_BaseExpression) < 0) __PYX_ERR(0, 358, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_51flatten, 0, __pyx_n_s_BaseExpression_flatten, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__223)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__224);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_flatten, __pyx_t_3) < 0) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":361
 *         return self
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         """
 *         To allow usage of expression as dictionary keys,
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_53__hash__, 0, __pyx_n_s_BaseExpression___hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__226)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_hash, __pyx_t_3) < 0) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":368
 *         raise NotImplementedError
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         # whereas __hash__ is for internal Mathics purposes like using Expressions as dictionary keys and fast
 *         # comparison of elements, user_hash is called for Hash[]. user_hash should strive to give stable results
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, Py_None) < 0) __PYX_ERR(0, 368, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_55user_hash, 0, __pyx_n_s_BaseExpression_user_hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__228)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_user_hash, __pyx_t_5) < 0) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":375
 *         raise NotImplementedError
 * 
 *     def sameQ(self, rhs) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return id(self) == id(rhs)
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 375, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_57sameQ, 0, __pyx_n_s_BaseExpression_sameQ, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__230)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_sameQ, __pyx_t_3) < 0) __PYX_ERR(0, 375, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":379
 *         return id(self) == id(rhs)
 * 
 *     def get_sequence(self):             # <<<<<<<<<<<<<<
 *         if self.get_head().get_name() == "System`Sequence":
 *             return self.leaves
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_59get_sequence, 0, __pyx_n_s_BaseExpression_get_sequence, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__232)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_sequence, __pyx_t_3) < 0) __PYX_ERR(0, 379, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":385
 *             return [self]
 * 
 *     def evaluate_leaves(self, evaluation) -> "BaseExpression":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_BaseExpression) < 0) __PYX_ERR(0, 385, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_61evaluate_leaves, 0, __pyx_n_s_BaseExpression_evaluate_leaves, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__234)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_evaluate_leaves, __pyx_t_5) < 0) __PYX_ERR(0, 385, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":388
 *         return self
 * 
 *     def apply_rules(             # <<<<<<<<<<<<<<
 *         self, rules, evaluation, level=0, options=None
 *     ) -> typing.Tuple["BaseExpression", bool]:
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "mathics/core/expression.py":390
 *     def apply_rules(
 *         self, rules, evaluation, level=0, options=None
 *     ) -> typing.Tuple["BaseExpression", bool]:             # <<<<<<<<<<<<<<
 *         if options:
 *             l1, l2 = options["levelspec"]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_typing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_u_BaseExpression);
  __Pyx_GIVEREF(__pyx_n_u_BaseExpression);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_BaseExpression);
  __Pyx_INCREF(((PyObject*)&PyBool_Type));
  __Pyx_GIVEREF(((PyObject*)&PyBool_Type));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject*)&PyBool_Type));
  __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 390, __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;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_t_7) < 0) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":388
 *         return self
 * 
 *     def apply_rules(             # <<<<<<<<<<<<<<
 *         self, rules, evaluation, level=0, options=None
 *     ) -> typing.Tuple["BaseExpression", bool]:
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_63apply_rules, 0, __pyx_n_s_BaseExpression_apply_rules, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__236)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__237);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_apply_rules, __pyx_t_7) < 0) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":404
 *         return self, False
 * 
 *     def do_format(self, evaluation, form):             # <<<<<<<<<<<<<<
 *         """
 *         Applies formats associated to the expression and removes
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_65do_format, 0, __pyx_n_s_BaseExpression_do_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__239)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_do_format, __pyx_t_7) < 0) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":516
 *             evaluation.dec_recursion_depth()
 * 
 *     def format(             # <<<<<<<<<<<<<<
 *         self, evaluation, form, **kwargs
 *     ) -> typing.Union["Expression", "Symbol"]:
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "mathics/core/expression.py":518
 *     def format(
 *         self, evaluation, form, **kwargs
 *     ) -> typing.Union["Expression", "Symbol"]:             # <<<<<<<<<<<<<<
 *         """
 *         Applies formats associated to the expression, and then calls Makeboxes
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_typing); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Union); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_tuple__242); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":516
 *             evaluation.dec_recursion_depth()
 * 
 *     def format(             # <<<<<<<<<<<<<<
 *         self, evaluation, form, **kwargs
 *     ) -> typing.Union["Expression", "Symbol"]:
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_67format, 0, __pyx_n_s_BaseExpression_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__241)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_format, __pyx_t_5) < 0) __PYX_ERR(0, 516, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":526
 *         return result
 * 
 *     def is_free(self, form, evaluation) -> bool:             # <<<<<<<<<<<<<<
 *         from mathics.builtin.patterns import item_is_free
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 526, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_69is_free, 0, __pyx_n_s_BaseExpression_is_free, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__244)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_is_free, __pyx_t_7) < 0) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":531
 *         return item_is_free(self, form, evaluation)
 * 
 *     def is_inexact(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.get_precision() is not None
 * 
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 531, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_71is_inexact, 0, __pyx_n_s_BaseExpression_is_inexact, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__246)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_is_inexact, __pyx_t_5) < 0) __PYX_ERR(0, 531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":534
 *         return self.get_precision() is not None
 * 
 *     def get_precision(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_73get_precision, 0, __pyx_n_s_BaseExpression_get_precision, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__248)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_precision, __pyx_t_5) < 0) __PYX_ERR(0, 534, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":537
 *         return None
 * 
 *     def get_option_values(self, evaluation, allow_symbols=False, stop_on_error=True):             # <<<<<<<<<<<<<<
 *         options = self
 *         if options.has_form("List", None):
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_75get_option_values, 0, __pyx_n_s_BaseExpression_get_option_values, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__250)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__251);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_option_values, __pyx_t_5) < 0) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":567
 *         return option_values
 * 
 *     def get_rules_list(self):             # <<<<<<<<<<<<<<
 *         from mathics.core.rules import Rule
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_77get_rules_list, 0, __pyx_n_s_BaseExpression_get_rules_list, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__253)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_rules_list, __pyx_t_5) < 0) __PYX_ERR(0, 567, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":584
 *         return rules
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_79to_sympy, 0, __pyx_n_s_BaseExpression_to_sympy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__255)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_to_sympy, __pyx_t_5) < 0) __PYX_ERR(0, 584, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":587
 *         raise NotImplementedError
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_81to_mpmath, 0, __pyx_n_s_BaseExpression_to_mpmath, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__257)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_to_mpmath, __pyx_t_5) < 0) __PYX_ERR(0, 587, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":590
 *         return None
 * 
 *     def round_to_float(self, evaluation=None, permit_complex=False):             # <<<<<<<<<<<<<<
 *         """
 *         Try to round to python float. Return None if not possible.
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_83round_to_float, 0, __pyx_n_s_BaseExpression_round_to_float, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__259)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__260);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_round_to_float, __pyx_t_5) < 0) __PYX_ERR(0, 590, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":602
 *             return value.get_float_value(permit_complex=permit_complex)
 * 
 *     def __abs__(self) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Abs", self)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 602, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_85__abs__, 0, __pyx_n_s_BaseExpression___abs, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__262)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_abs, __pyx_t_7) < 0) __PYX_ERR(0, 602, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":605
 *         return Expression("Abs", self)
 * 
 *     def __pos__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_87__pos__, 0, __pyx_n_s_BaseExpression___pos, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__264)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_pos, __pyx_t_7) < 0) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":608
 *         return self
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return Expression("Times", self, -1)
 * 
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_89__neg__, 0, __pyx_n_s_BaseExpression___neg, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__266)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_neg, __pyx_t_7) < 0) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":611
 *         return Expression("Times", self, -1)
 * 
 *     def __add__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Plus", self, other)
 * 
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 611, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_91__add__, 0, __pyx_n_s_BaseExpression___add, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__268)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_add, __pyx_t_5) < 0) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":614
 *         return Expression("Plus", self, other)
 * 
 *     def __sub__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Plus", self, Expression("Times", other, -1))
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_93__sub__, 0, __pyx_n_s_BaseExpression___sub, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__270)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_sub_2, __pyx_t_7) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":617
 *         return Expression("Plus", self, Expression("Times", other, -1))
 * 
 *     def __mul__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Times", self, other)
 * 
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 617, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_95__mul__, 0, __pyx_n_s_BaseExpression___mul, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__272)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_mul, __pyx_t_5) < 0) __PYX_ERR(0, 617, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":620
 *         return Expression("Times", self, other)
 * 
 *     def __truediv__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Divide", self, other)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 620, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_97__truediv__, 0, __pyx_n_s_BaseExpression___truediv, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__274)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_truediv, __pyx_t_7) < 0) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":623
 *         return Expression("Divide", self, other)
 * 
 *     def __floordiv__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Floor", Expression("Divide", self, other))
 * 
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 623, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_99__floordiv__, 0, __pyx_n_s_BaseExpression___floordiv, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__276)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_floordiv, __pyx_t_5) < 0) __PYX_ERR(0, 623, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":626
 *         return Expression("Floor", Expression("Divide", self, other))
 * 
 *     def __pow__(self, other) -> "Expression":             # <<<<<<<<<<<<<<
 *         return Expression("Power", self, other)
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 626, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_14BaseExpression_101__pow__, 0, __pyx_n_s_BaseExpression___pow, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__278)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_pow, __pyx_t_7) < 0) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":254
 * 
 * 
 * class BaseExpression(KeyComparable):             # <<<<<<<<<<<<<<
 *     options: Any
 *     pattern_sequence: bool
 */
  __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_BaseExpression, __pyx_t_6, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BaseExpression, __pyx_t_7) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":630
 * 
 * 
 * class Monomial(object):             # <<<<<<<<<<<<<<
 *     """
 *     An object to sort monomials, used in Expression.get_sort_key and
 */
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__279); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_tuple__279, __pyx_n_s_Monomial, __pyx_n_s_Monomial, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, __pyx_kp_s_An_object_to_sort_monomials_use); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "mathics/core/expression.py":636
 *     """
 * 
 *     def __init__(self, exps_dict):             # <<<<<<<<<<<<<<
 *         self.exps = exps_dict
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Monomial_1__init__, 0, __pyx_n_s_Monomial___init, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__281)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 636, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":639
 *         self.exps = exps_dict
 * 
 *     def __lt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) < 0
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 639, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Monomial_3__lt__, 0, __pyx_n_s_Monomial___lt, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__283)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_lt_2, __pyx_t_7) < 0) __PYX_ERR(0, 639, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":642
 *         return self.__cmp(other) < 0
 * 
 *     def __gt__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) > 0
 * 
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 642, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Monomial_5__gt__, 0, __pyx_n_s_Monomial___gt, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__285)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_gt_2, __pyx_t_1) < 0) __PYX_ERR(0, 642, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":645
 *         return self.__cmp(other) > 0
 * 
 *     def __le__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) <= 0
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 645, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Monomial_7__le__, 0, __pyx_n_s_Monomial___le, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__287)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_le, __pyx_t_7) < 0) __PYX_ERR(0, 645, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":648
 *         return self.__cmp(other) <= 0
 * 
 *     def __ge__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) >= 0
 * 
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 648, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Monomial_9__ge__, 0, __pyx_n_s_Monomial___ge, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__289)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_ge, __pyx_t_1) < 0) __PYX_ERR(0, 648, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":651
 *         return self.__cmp(other) >= 0
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) == 0
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 651, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Monomial_11__eq__, 0, __pyx_n_s_Monomial___eq, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__291)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_eq, __pyx_t_7) < 0) __PYX_ERR(0, 651, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":654
 *         return self.__cmp(other) == 0
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         return self.__cmp(other) != 0
 * 
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 654, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Monomial_13__ne__, 0, __pyx_n_s_Monomial___ne, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__293)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_ne, __pyx_t_1) < 0) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":657
 *         return self.__cmp(other) != 0
 * 
 *     def __cmp(self, other) -> int:             # <<<<<<<<<<<<<<
 *         self_exps = self.exps.copy()
 *         other_exps = other.exps.copy()
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_int_2) < 0) __PYX_ERR(0, 657, __pyx_L1_error)
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Monomial_15__cmp, 0, __pyx_n_s_Monomial___cmp, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__295)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_Monomial__cmp, __pyx_t_7) < 0) __PYX_ERR(0, 657, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":630
 * 
 * 
 * class Monomial(object):             # <<<<<<<<<<<<<<
 *     """
 *     An object to sort monomials, used in Expression.get_sort_key and
 */
  __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_Monomial, __pyx_tuple__279, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Monomial, __pyx_t_7) < 0) __PYX_ERR(0, 630, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":709
 * 
 * 
 * class Expression(BaseExpression):             # <<<<<<<<<<<<<<
 *     head: "Symbol"
 *     leaves: typing.List[Any]
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_BaseExpression); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_2, __pyx_n_s_Expression, __pyx_n_s_Expression, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "mathics/core/expression.py":714
 *     _sequences: Any
 * 
 *     def __new__(cls, head, *leaves, **kwargs) -> "Expression":             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if isinstance(head, str):
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 714, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Expression___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__297)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_t_3);
  PyList_Append(__pyx_t_1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_new_2, __pyx_t_3) < 0) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":725
 * 
 *     @property
 *     def head(self):             # <<<<<<<<<<<<<<
 *         return self._head
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_3head, 0, __pyx_n_s_Expression_head, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__299)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/core/expression.py":724
 *         return self
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def head(self):
 *         return self._head
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_head, __pyx_t_5) < 0) __PYX_ERR(0, 725, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":728
 *         return self._head
 * 
 *     @head.setter             # <<<<<<<<<<<<<<
 *     def head(self, value):
 *         raise ValueError("Expression.head is write protected.")
 */
  __pyx_t_3 = PyObject_GetItem(__pyx_t_7, __pyx_n_s_head);
  if (unlikely(!__pyx_t_3)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_head);
  }
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_setter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":729
 * 
 *     @head.setter
 *     def head(self, value):             # <<<<<<<<<<<<<<
 *         raise ValueError("Expression.head is write protected.")
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_5head, 0, __pyx_n_s_Expression_head, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__301)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_head, __pyx_t_5) < 0) __PYX_ERR(0, 729, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":733
 * 
 *     @property
 *     def leaves(self):             # <<<<<<<<<<<<<<
 *         return self._leaves
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_7leaves, 0, __pyx_n_s_Expression_leaves, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__303)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "mathics/core/expression.py":732
 *         raise ValueError("Expression.head is write protected.")
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def leaves(self):
 *         return self._leaves
 */
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_leaves, __pyx_t_4) < 0) __PYX_ERR(0, 733, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":736
 *         return self._leaves
 * 
 *     @leaves.setter             # <<<<<<<<<<<<<<
 *     def leaves(self, value):
 *         raise ValueError("Expression.leaves is write protected.")
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_7, __pyx_n_s_leaves);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_leaves);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_setter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":737
 * 
 *     @leaves.setter
 *     def leaves(self, value):             # <<<<<<<<<<<<<<
 *         raise ValueError("Expression.leaves is write protected.")
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_9leaves, 0, __pyx_n_s_Expression_leaves, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__305)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __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_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_leaves, __pyx_t_4) < 0) __PYX_ERR(0, 737, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":740
 *         raise ValueError("Expression.leaves is write protected.")
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Any); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_rhs, __pyx_t_3) < 0) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Optional); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, ((PyObject*)&PyBool_Type)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_11equal2, 0, __pyx_n_s_Expression_equal2, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__307)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_equal2, __pyx_t_5) < 0) __PYX_ERR(0, 740, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":767
 *         return None
 * 
 *     def slice(self, head, py_slice, evaluation):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, *self.leaves[py_slice])
 *         return structure(head, self, evaluation).slice(self, py_slice)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_13slice, 0, __pyx_n_s_Expression_slice, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__309)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_slice, __pyx_t_5) < 0) __PYX_ERR(0, 767, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":771
 *         return structure(head, self, evaluation).slice(self, py_slice)
 * 
 *     def filter(self, head, cond, evaluation):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, [leaf in self.leaves if cond(leaf)])
 *         return structure(head, self, evaluation).filter(self, cond)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_15filter, 0, __pyx_n_s_Expression_filter, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__311)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_filter, __pyx_t_5) < 0) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":775
 *         return structure(head, self, evaluation).filter(self, cond)
 * 
 *     def restructure(self, head, leaves, evaluation, structure_cache=None, deps=None):             # <<<<<<<<<<<<<<
 *         # faster equivalent to: Expression(head, *leaves)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_17restructure, 0, __pyx_n_s_Expression_restructure, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__313)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__314);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_restructure, __pyx_t_5) < 0) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":791
 *         return s(list(leaves))
 * 
 *     def _no_symbol(self, symbol_name):             # <<<<<<<<<<<<<<
 *         # if this return True, it's safe to say that self.leaves or its
 *         # sub leaves contain no Symbol with symbol_name. if this returns
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_19_no_symbol, 0, __pyx_n_s_Expression__no_symbol, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__316)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_no_symbol, __pyx_t_5) < 0) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":806
 *             return False
 * 
 *     def sequences(self):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 *         if cache:
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_21sequences, 0, __pyx_n_s_Expression_sequences, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__318)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_sequences, __pyx_t_5) < 0) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":815
 *         return self._rebuild_cache().sequences
 * 
 *     def _flatten_sequence(self, sequence, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         indices = self.sequences()
 *         if not indices:
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 815, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_23_flatten_sequence, 0, __pyx_n_s_Expression__flatten_sequence, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__320)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_flatten_sequence, __pyx_t_4) < 0) __PYX_ERR(0, 815, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":834
 *         return self.restructure(self._head, flattened, evaluation)
 * 
 *     def flatten_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             if leaf.get_head_name() == "System`Sequence":
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_25flatten_sequence, 0, __pyx_n_s_Expression_flatten_sequence, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__322)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_flatten_sequence_2, __pyx_t_4) < 0) __PYX_ERR(0, 834, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":843
 *         return self._flatten_sequence(sequence, evaluation)
 * 
 *     def flatten_pattern_sequence(self, evaluation):             # <<<<<<<<<<<<<<
 *         def sequence(leaf):
 *             flattened = leaf.flatten_pattern_sequence(evaluation)
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_27flatten_pattern_sequence, 0, __pyx_n_s_Expression_flatten_pattern_seque_2, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__324)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_flatten_pattern_sequence, __pyx_t_4) < 0) __PYX_ERR(0, 843, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":856
 *         return expr
 * 
 *     def _rebuild_cache(self):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_29_rebuild_cache, 0, __pyx_n_s_Expression__rebuild_cache, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__326)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_rebuild_cache, __pyx_t_4) < 0) __PYX_ERR(0, 856, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":884
 *         return cache
 * 
 *     def has_changed(self, definitions):             # <<<<<<<<<<<<<<
 *         cache = self._cache
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_31has_changed, 0, __pyx_n_s_Expression_has_changed, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__328)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_has_changed, __pyx_t_4) < 0) __PYX_ERR(0, 884, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":900
 *         return definitions.has_changed(time, cache.symbols)
 * 
 *     def _timestamp_cache(self, evaluation):             # <<<<<<<<<<<<<<
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_33_timestamp_cache, 0, __pyx_n_s_Expression__timestamp_cache, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__330)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_timestamp_cache, __pyx_t_4) < 0) __PYX_ERR(0, 900, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":903
 *         self._cache = ExpressionCache(evaluation.definitions.now, copy=self._cache)
 * 
 *     def copy(self, reevaluate=False) -> "Expression":             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head.copy(reevaluate))
 *         expr._leaves = tuple(leaf.copy(reevaluate) for leaf in self._leaves)
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 903, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_35copy, 0, __pyx_n_s_Expression_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__332)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__333);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_copy, __pyx_t_5) < 0) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":916
 *         return expr
 * 
 *     def do_format(self, evaluation, form):             # <<<<<<<<<<<<<<
 *         if self._format_cache is None:
 *             self._format_cache = {}
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_37do_format, 0, __pyx_n_s_Expression_do_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__335)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_5);
  PyList_Append(__pyx_t_1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_do_format, __pyx_t_5) < 0) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":932
 *         return expr
 * 
 *     def shallow_copy(self) -> "Expression":             # <<<<<<<<<<<<<<
 *         # this is a minimal, shallow copy: head, leaves are shared with
 *         # the original, only the Expression instance is new.
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 932, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_39shallow_copy, 0, __pyx_n_s_Expression_shallow_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__337)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_shallow_copy, __pyx_t_4) < 0) __PYX_ERR(0, 932, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":944
 *         return expr
 * 
 *     def set_positions(self, position=None) -> None:             # <<<<<<<<<<<<<<
 *         self.position = position
 *         self._head.set_positions(ExpressionPointer(self, 0))
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, Py_None) < 0) __PYX_ERR(0, 944, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_41set_positions, 0, __pyx_n_s_Expression_set_positions, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__339)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__340);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_set_positions, __pyx_t_5) < 0) __PYX_ERR(0, 944, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":950
 *             leaf.set_positions(ExpressionPointer(self, index + 1))
 * 
 *     def get_head(self):             # <<<<<<<<<<<<<<
 *         return self._head
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_43get_head, 0, __pyx_n_s_Expression_get_head, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__342)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_head, __pyx_t_5) < 0) __PYX_ERR(0, 950, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":953
 *         return self._head
 * 
 *     def set_head(self, head):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = None
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_45set_head, 0, __pyx_n_s_Expression_set_head, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__344)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_set_head, __pyx_t_5) < 0) __PYX_ERR(0, 953, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":957
 *         self._cache = None
 * 
 *     def get_leaves(self):             # <<<<<<<<<<<<<<
 *         return self._leaves
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_47get_leaves, 0, __pyx_n_s_Expression_get_leaves, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__346)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_leaves, __pyx_t_5) < 0) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":960
 *         return self._leaves
 * 
 *     def get_mutable_leaves(self):  # shallow, mutable copy of the leaves array             # <<<<<<<<<<<<<<
 *         return list(self._leaves)
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_49get_mutable_leaves, 0, __pyx_n_s_Expression_get_mutable_leaves, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__348)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_mutable_leaves, __pyx_t_5) < 0) __PYX_ERR(0, 960, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":963
 *         return list(self._leaves)
 * 
 *     def set_leaf(self, index, value):  # leaves are removed, added or replaced             # <<<<<<<<<<<<<<
 *         leaves = list(self._leaves)
 *         leaves[index] = value
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_51set_leaf, 0, __pyx_n_s_Expression_set_leaf, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__350)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_set_leaf, __pyx_t_5) < 0) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":969
 *         self._cache = None
 * 
 *     def set_reordered_leaves(self, leaves):  # same leaves, but in a different order             # <<<<<<<<<<<<<<
 *         self._leaves = tuple(leaves)
 *         if self._cache:
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_53set_reordered_leaves, 0, __pyx_n_s_Expression_set_reordered_leaves, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__352)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_set_reordered_leaves, __pyx_t_5) < 0) __PYX_ERR(0, 969, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":974
 *             self._cache = self._cache.reordered()
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         if self.get_head_name() == "System`Function" and len(self._leaves) > 2:
 *             res = self._leaves[2]
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_55get_attributes, 0, __pyx_n_s_Expression_get_attributes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__354)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_attributes, __pyx_t_5) < 0) __PYX_ERR(0, 974, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":983
 *         return set()
 * 
 *     def get_lookup_name(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self._head.get_lookup_name()
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 983, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_57get_lookup_name, 0, __pyx_n_s_Expression_get_lookup_name, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__356)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_lookup_name, __pyx_t_4) < 0) __PYX_ERR(0, 983, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":986
 *         return self._head.get_lookup_name()
 * 
 *     def has_form(self, heads, *leaf_counts):             # <<<<<<<<<<<<<<
 *         """
 *         leaf_counts:
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_59has_form, 0, __pyx_n_s_Expression_has_form, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__358)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_has_form, __pyx_t_4) < 0) __PYX_ERR(0, 986, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1017
 *         return True
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         if self._no_symbol(symbol_name):
 *             return False
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 1017, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_61has_symbol, 0, __pyx_n_s_Expression_has_symbol, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__360)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_has_symbol, __pyx_t_5) < 0) __PYX_ERR(0, 1017, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1024
 *         )
 * 
 *     def _as_sympy_function(self, **kwargs) -> sympy.Function:             # <<<<<<<<<<<<<<
 *         sym_args = [leaf.to_sympy(**kwargs) for leaf in self.leaves]
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sympy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Function); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_t_3) < 0) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_63_as_sympy_function, 0, __pyx_n_s_Expression__as_sympy_function, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__362)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_as_sympy_function, __pyx_t_3) < 0) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":1033
 *         return f(*sym_args)
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         from mathics.builtin import mathics_to_sympy
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_65to_sympy, 0, __pyx_n_s_Expression_to_sympy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__364)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_sympy, __pyx_t_3) < 0) __PYX_ERR(0, 1033, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":1061
 *         return SympyExpression(self)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """
 *         Convert the Expression to a Python object:
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_67to_python, 0, __pyx_n_s_Expression_to_python, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__366)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_python, __pyx_t_3) < 0) __PYX_ERR(0, 1061, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":1110
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 * 
 *         if pattern_sort:
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_69get_sort_key, 0, __pyx_n_s_Expression_get_sort_key, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__368)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__369);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_sort_key, __pyx_t_3) < 0) __PYX_ERR(0, 1110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":1241
 *                 return [1 if self.is_numeric() else 2, 3, self._head, self._leaves, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if id(self) == id(other):
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 1241, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_71sameQ, 0, __pyx_n_s_Expression_sameQ, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__371)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_sameQ, __pyx_t_5) < 0) __PYX_ERR(0, 1241, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1256
 *         return True
 * 
 *     def flatten(             # <<<<<<<<<<<<<<
 *         self, head, pattern_only=False, callback=None, level=None
 *     ) -> "Expression":
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 1256, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_73flatten, 0, __pyx_n_s_Expression_flatten, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__373)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__374);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_flatten, __pyx_t_3) < 0) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":1289
 *             return self
 * 
 *     def evaluate(self, evaluation) -> typing.Union["Expression", "Symbol"]:             # <<<<<<<<<<<<<<
 *         from mathics.core.evaluation import ReturnInterrupt
 * 
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_typing); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Union); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_tuple__242); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_75evaluate, 0, __pyx_n_s_Expression_evaluate, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__376)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_evaluate, __pyx_t_5) < 0) __PYX_ERR(0, 1289, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1345
 *         return expr
 * 
 *     def evaluate_next(self, evaluation) -> typing.Tuple["Expression", bool]:             # <<<<<<<<<<<<<<
 *         from mathics.builtin.base import BoxConstruct
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_typing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_n_u_Expression);
  __Pyx_GIVEREF(__pyx_n_u_Expression);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_Expression);
  __Pyx_INCREF(((PyObject*)&PyBool_Type));
  __Pyx_GIVEREF(((PyObject*)&PyBool_Type));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject*)&PyBool_Type));
  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_t_8) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_77evaluate_next, 0, __pyx_n_s_Expression_evaluate_next, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__378)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_evaluate_next, __pyx_t_8) < 0) __PYX_ERR(0, 1345, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1476
 *         return new, False
 * 
 *     def evaluate_leaves(self, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         leaves = [leaf.evaluate(evaluation) for leaf in self._leaves]
 *         head = self._head.evaluate_leaves(evaluation)
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 1476, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_79evaluate_leaves, 0, __pyx_n_s_Expression_evaluate_leaves, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__380)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_evaluate_leaves, __pyx_t_5) < 0) __PYX_ERR(0, 1476, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1481
 *         return Expression(head, *leaves)
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[%s]" % (
 *             self._head,
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1481, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_81__str__, 0, __pyx_n_s_Expression___str, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__382)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_str, __pyx_t_8) < 0) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1487
 *         )
 * 
 *     def __repr__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "<Expression: %s>" % self
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1487, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_83__repr__, 0, __pyx_n_s_Expression___repr, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__384)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_repr, __pyx_t_5) < 0) __PYX_ERR(0, 1487, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1490
 *         return "<Expression: %s>" % self
 * 
 *     def process_style_box(self, options):             # <<<<<<<<<<<<<<
 *         if self.has_form("StyleBox", 1, None):
 *             rules = self._leaves[1:]
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_85process_style_box, 0, __pyx_n_s_Expression_process_style_box, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__386)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_process_style_box, __pyx_t_5) < 0) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1512
 *             return False, options
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1512, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_87boxes_to_text, 0, __pyx_n_s_Expression_boxes_to_text, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__388)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_boxes_to_text, __pyx_t_8) < 0) __PYX_ERR(0, 1512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1531
 *             raise BoxError(self, "text")
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         is_style, options = self.process_style_box(options)
 *         if is_style:
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1531, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_89boxes_to_mathml, 0, __pyx_n_s_Expression_boxes_to_mathml, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__390)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_boxes_to_mathml, __pyx_t_5) < 0) __PYX_ERR(0, 1531, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1608
 *                 raise BoxError(self, "xml")
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         def block(tex, only_subsup=False):
 *             if len(tex) == 1:
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1608, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_91boxes_to_tex, 0, __pyx_n_s_Expression_boxes_to_tex, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__392)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_boxes_to_tex, __pyx_t_8) < 0) __PYX_ERR(0, 1608, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1663
 *             raise BoxError(self, "tex")
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "%s[%s]" % (
 *             self._head.default_format(evaluation, form),
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1663, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_93default_format, 0, __pyx_n_s_Expression_default_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__394)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_default_format, __pyx_t_5) < 0) __PYX_ERR(0, 1663, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1669
 *         )
 * 
 *     def sort(self, pattern=False):             # <<<<<<<<<<<<<<
 *         "Sort the leaves according to internal ordering."
 *         leaves = list(self._leaves)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_95sort, 0, __pyx_n_s_Expression_sort, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__396)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__397);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_sort, __pyx_t_5) < 0) __PYX_ERR(0, 1669, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1678
 *         self.set_reordered_leaves(leaves)
 * 
 *     def filter_leaves(self, head_name):             # <<<<<<<<<<<<<<
 *         # TODO: should use sorting
 *         head_name = ensure_context(head_name)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_97filter_leaves, 0, __pyx_n_s_Expression_filter_leaves, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__399)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_filter_leaves, __pyx_t_5) < 0) __PYX_ERR(0, 1678, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1687
 *             return [leaf for leaf in self._leaves if leaf.get_head_name() == head_name]
 * 
 *     def apply_rules(self, rules, evaluation, level=0, options=None):             # <<<<<<<<<<<<<<
 *         """for rule in rules:
 *         result = rule.apply(self, evaluation, fully=False)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_99apply_rules, 0, __pyx_n_s_Expression_apply_rules, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__401)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_5);
  PyList_Append(__pyx_t_1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__402);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_apply_rules, __pyx_t_5) < 0) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":1726
 *             return expr, new_applied[0]
 * 
 *     def replace_vars(             # <<<<<<<<<<<<<<
 *         self, vars, options=None, in_scoping=True, in_function=True
 *     ) -> "Expression":
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 1726, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_101replace_vars, 0, __pyx_n_s_Expression_replace_vars, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__404)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__405);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_replace_vars, __pyx_t_8) < 0) __PYX_ERR(0, 1726, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1781
 *         )
 * 
 *     def replace_slots(self, slots, evaluation):             # <<<<<<<<<<<<<<
 *         if self._head.get_name() == "System`Slot":
 *             if len(self._leaves) != 1:
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_103replace_slots, 0, __pyx_n_s_Expression_replace_slots, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__407)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_replace_slots, __pyx_t_8) < 0) __PYX_ERR(0, 1781, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1809
 *         )
 * 
 *     def thread(self, evaluation, head=None) -> typing.Tuple[bool, "Expression"]:             # <<<<<<<<<<<<<<
 *         if head is None:
 *             head = Symbol("List")
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_typing); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject*)&PyBool_Type));
  __Pyx_GIVEREF(((PyObject*)&PyBool_Type));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject*)&PyBool_Type));
  __Pyx_INCREF(__pyx_n_u_Expression);
  __Pyx_GIVEREF(__pyx_n_u_Expression);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_u_Expression);
  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_t_4) < 0) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_105thread, 0, __pyx_n_s_Expression_thread, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__409)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__410);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_thread, __pyx_t_4) < 0) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1838
 *             return True, Expression(head, *leaves)
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             self._head.get_name()
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 1838, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_107is_numeric, 0, __pyx_n_s_Expression_is_numeric, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__412)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_numeric, __pyx_t_8) < 0) __PYX_ERR(0, 1838, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1857
 *         # attribute
 * 
 *     def numerify(self, evaluation) -> "Expression":             # <<<<<<<<<<<<<<
 *         _prec = None
 *         for leaf in self._leaves:
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 1857, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_109numerify, 0, __pyx_n_s_Expression_numerify, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__414)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_numerify, __pyx_t_4) < 0) __PYX_ERR(0, 1857, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1880
 *             return self
 * 
 *     def get_atoms(self, include_heads=True):             # <<<<<<<<<<<<<<
 *         if include_heads:
 *             atoms = self._head.get_atoms()
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_111get_atoms, 0, __pyx_n_s_Expression_get_atoms, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__416)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__417);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_atoms, __pyx_t_4) < 0) __PYX_ERR(0, 1880, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1889
 *         return atoms
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Expression", self._head) + tuple(self._leaves))
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_113__hash__, 0, __pyx_n_s_Expression___hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__419)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_hash, __pyx_t_4) < 0) __PYX_ERR(0, 1889, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1892
 *         return hash(("Expression", self._head) + tuple(self._leaves))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         update(("%s>%d>" % (self.get_head_name(), len(self._leaves))).encode("utf8"))
 *         for leaf in self._leaves:
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_115user_hash, 0, __pyx_n_s_Expression_user_hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__421)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_user_hash, __pyx_t_4) < 0) __PYX_ERR(0, 1892, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":1897
 *             leaf.user_hash(update)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self._head, self._leaves)
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_10Expression_117__getnewargs__, 0, __pyx_n_s_Expression___getnewargs, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__423)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_getnewargs, __pyx_t_4) < 0) __PYX_ERR(0, 1897, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":709
 * 
 * 
 * class Expression(BaseExpression):             # <<<<<<<<<<<<<<
 *     head: "Symbol"
 *     leaves: typing.List[Any]
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_Expression, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_1, __pyx_t_4) < 0) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Expression, __pyx_t_4) < 0) __PYX_ERR(0, 709, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":1901
 * 
 * 
 * class Atom(BaseExpression):             # <<<<<<<<<<<<<<
 *     def is_atom(self) -> bool:
 *         return True
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BaseExpression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_6, __pyx_n_s_Atom, __pyx_n_s_Atom, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "mathics/core/expression.py":1902
 * 
 * class Atom(BaseExpression):
 *     def is_atom(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 1902, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_1is_atom, 0, __pyx_n_s_Atom_is_atom, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__425)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_atom, __pyx_t_1) < 0) __PYX_ERR(0, 1902, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1905
 *         return True
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)
 *         returns True if self and rhs are identical.
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Any); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_rhs, __pyx_t_4) < 0) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Optional); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_4, ((PyObject*)&PyBool_Type)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_t_8) < 0) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_3equal2, 0, __pyx_n_s_Atom_equal2, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__427)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_equal2, __pyx_t_8) < 0) __PYX_ERR(0, 1905, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1915
 *         return self == rhs
 * 
 *     def has_form(self, heads, *leaf_counts) -> bool:             # <<<<<<<<<<<<<<
 *         if leaf_counts:
 *             return False
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 1915, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_5has_form, 0, __pyx_n_s_Atom_has_form, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__429)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_has_form, __pyx_t_1) < 0) __PYX_ERR(0, 1915, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1924
 *             return heads == name
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 1924, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_7has_symbol, 0, __pyx_n_s_Atom_has_symbol, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__431)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_has_symbol, __pyx_t_8) < 0) __PYX_ERR(0, 1924, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1927
 *         return False
 * 
 *     def get_head(self) -> "Symbol":             # <<<<<<<<<<<<<<
 *         return Symbol(self.get_atom_name())
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Symbol) < 0) __PYX_ERR(0, 1927, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_9get_head, 0, __pyx_n_s_Atom_get_head, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__433)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1927, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_head, __pyx_t_1) < 0) __PYX_ERR(0, 1927, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1930
 *         return Symbol(self.get_atom_name())
 * 
 *     def get_atom_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.__class__.__name__
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1930, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_11get_atom_name, 0, __pyx_n_s_Atom_get_atom_name, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__435)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_atom_name, __pyx_t_8) < 0) __PYX_ERR(0, 1930, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1933
 *         return self.__class__.__name__
 * 
 *     def __repr__(self) -> str:             # <<<<<<<<<<<<<<
 *         return "<%s: %s>" % (self.get_atom_name(), self)
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1933, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_13__repr__, 0, __pyx_n_s_Atom___repr, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__437)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_repr, __pyx_t_1) < 0) __PYX_ERR(0, 1933, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1936
 *         return "<%s: %s>" % (self.get_atom_name(), self)
 * 
 *     def replace_vars(self, vars, options=None, in_scoping=True) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_Atom) < 0) __PYX_ERR(0, 1936, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_15replace_vars, 0, __pyx_n_s_Atom_replace_vars, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__439)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__440);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_replace_vars, __pyx_t_8) < 0) __PYX_ERR(0, 1936, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1939
 *         return self
 * 
 *     def replace_slots(self, slots, evaluation) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Atom) < 0) __PYX_ERR(0, 1939, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_17replace_slots, 0, __pyx_n_s_Atom_replace_slots, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__442)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_replace_slots, __pyx_t_1) < 0) __PYX_ERR(0, 1939, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1942
 *         return self
 * 
 *     def numerify(self, evaluation) -> "Atom":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_Atom) < 0) __PYX_ERR(0, 1942, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_19numerify, 0, __pyx_n_s_Atom_numerify, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__444)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_numerify, __pyx_t_8) < 0) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1945
 *         return self
 * 
 *     def copy(self, reevaluate=False) -> "Atom":             # <<<<<<<<<<<<<<
 *         result = self.do_copy()
 *         result.original = self
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Atom) < 0) __PYX_ERR(0, 1945, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_21copy, 0, __pyx_n_s_Atom_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__446)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__447);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_copy, __pyx_t_1) < 0) __PYX_ERR(0, 1945, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1950
 *         return result
 * 
 *     def set_positions(self, position=None) -> None:             # <<<<<<<<<<<<<<
 *         self.position = position
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, Py_None) < 0) __PYX_ERR(0, 1950, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_23set_positions, 0, __pyx_n_s_Atom_set_positions, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__449)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__450);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_set_positions, __pyx_t_8) < 0) __PYX_ERR(0, 1950, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1953
 *         self.position = position
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return [0, 0, 1, 1, 0, 0, 0, 1]
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_25get_sort_key, 0, __pyx_n_s_Atom_get_sort_key, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__452)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__453);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_sort_key, __pyx_t_8) < 0) __PYX_ERR(0, 1953, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1959
 *             raise NotImplementedError
 * 
 *     def get_atoms(self, include_heads=True) -> typing.List["Atom"]:             # <<<<<<<<<<<<<<
 *         return [self]
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_typing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_List); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_u_Atom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_t_1) < 0) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_27get_atoms, 0, __pyx_n_s_Atom_get_atoms, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__455)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__456);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_atoms, __pyx_t_1) < 0) __PYX_ERR(0, 1959, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1962
 *         return [self]
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Atom_29atom_to_boxes, 0, __pyx_n_s_Atom_atom_to_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__458)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_atom_to_boxes, __pyx_t_1) < 0) __PYX_ERR(0, 1962, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1901
 * 
 * 
 * class Atom(BaseExpression):             # <<<<<<<<<<<<<<
 *     def is_atom(self) -> bool:
 *         return True
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Atom, __pyx_t_6, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Atom, __pyx_t_1) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":1966
 * 
 * 
 * class Symbol(Atom):             # <<<<<<<<<<<<<<
 *     name: str
 *     sympy_dummy: Any
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Atom); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_2, __pyx_n_s_Symbol, __pyx_n_s_Symbol, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "mathics/core/expression.py":1969
 *     name: str
 *     sympy_dummy: Any
 *     defined_symbols = {}             # <<<<<<<<<<<<<<
 * 
 *     def __new__(cls, name, sympy_dummy=None):
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_defined_symbols, __pyx_t_1) < 0) __PYX_ERR(0, 1969, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1971
 *     defined_symbols = {}
 * 
 *     def __new__(cls, name, sympy_dummy=None):             # <<<<<<<<<<<<<<
 *         name = ensure_context(name)
 *         self = cls.defined_symbols.get(name, None)
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Symbol___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__460)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__461);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_new_2, __pyx_t_1) < 0) __PYX_ERR(0, 1971, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1981
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1981, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_3__str__, 0, __pyx_n_s_Symbol___str, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__463)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_str, __pyx_t_8) < 0) __PYX_ERR(0, 1981, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1984
 *         return self.name
 * 
 *     def do_copy(self) -> "Symbol":             # <<<<<<<<<<<<<<
 *         return Symbol(self.name)
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Symbol) < 0) __PYX_ERR(0, 1984, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_5do_copy, 0, __pyx_n_s_Symbol_do_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__465)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_do_copy, __pyx_t_1) < 0) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1987
 *         return Symbol(self.name)
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.name)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1987, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_7boxes_to_text, 0, __pyx_n_s_Symbol_boxes_to_text, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__467)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_boxes_to_text, __pyx_t_8) < 0) __PYX_ERR(0, 1987, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1990
 *         return str(self.name)
 * 
 *     def atom_to_boxes(self, f, evaluation) -> "String":             # <<<<<<<<<<<<<<
 *         return String(evaluation.definitions.shorten_name(self.name))
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_String) < 0) __PYX_ERR(0, 1990, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_9atom_to_boxes, 0, __pyx_n_s_Symbol_atom_to_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__469)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_atom_to_boxes, __pyx_t_1) < 0) __PYX_ERR(0, 1990, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1993
 *         return String(evaluation.definitions.shorten_name(self.name))
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         from mathics.builtin import mathics_to_sympy
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_11to_sympy, 0, __pyx_n_s_Symbol_to_sympy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__471)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_sympy, __pyx_t_1) < 0) __PYX_ERR(0, 1993, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2008
 *         return builtin.to_sympy(self, **kwargs)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         if self == SymbolTrue:
 *             return True
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_13to_python, 0, __pyx_n_s_Symbol_to_python, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__473)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_python, __pyx_t_1) < 0) __PYX_ERR(0, 2008, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2025
 *             return self.name
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2025, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_15default_format, 0, __pyx_n_s_Symbol_default_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__475)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_default_format, __pyx_t_8) < 0) __PYX_ERR(0, 2025, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2028
 *         return self.name
 * 
 *     def get_attributes(self, definitions):             # <<<<<<<<<<<<<<
 *         return definitions.get_attributes(self.name)
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_17get_attributes, 0, __pyx_n_s_Symbol_get_attributes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__477)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_attributes, __pyx_t_8) < 0) __PYX_ERR(0, 2028, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2031
 *         return definitions.get_attributes(self.name)
 * 
 *     def get_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2031, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_19get_name, 0, __pyx_n_s_Symbol_get_name, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__479)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_name, __pyx_t_1) < 0) __PYX_ERR(0, 2031, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2034
 *         return self.name
 * 
 *     def is_symbol(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2034, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_21is_symbol, 0, __pyx_n_s_Symbol_is_symbol, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__481)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_symbol, __pyx_t_8) < 0) __PYX_ERR(0, 2034, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2037
 *         return True
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super(Symbol, self).get_sort_key(True)
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_23get_sort_key, 0, __pyx_n_s_Symbol_get_sort_key, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__483)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__484);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_sort_key, __pyx_t_8) < 0) __PYX_ERR(0, 2037, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2050
 *             ]
 * 
 *     def equal2(self, rhs: Any) -> Optional[bool]:             # <<<<<<<<<<<<<<
 *         """Mathics two-argument Equal (==)"""
 *         if self.sameQ(rhs):
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Any); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_rhs, __pyx_t_1) < 0) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Optional); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, ((PyObject*)&PyBool_Type)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_t_4) < 0) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_25equal2, 0, __pyx_n_s_Symbol_equal2, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__486)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_equal2, __pyx_t_4) < 0) __PYX_ERR(0, 2050, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2063
 *         return None
 * 
 *     def sameQ(self, rhs: Any) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Any); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_rhs, __pyx_t_8) < 0) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2063, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_27sameQ, 0, __pyx_n_s_Symbol_sameQ, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__488)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_sameQ, __pyx_t_8) < 0) __PYX_ERR(0, 2063, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2067
 *         return id(self) == id(rhs) or isinstance(rhs, Symbol) and self.name == rhs.name
 * 
 *     def replace_vars(self, vars, options={}, in_scoping=True):             # <<<<<<<<<<<<<<
 *         assert all(fully_qualified_symbol_name(v) for v in vars)
 *         var = vars.get(self.name, None)
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_29replace_vars, 0, __pyx_n_s_Symbol_replace_vars, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__490)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_8, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 2067, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_8)->__pyx_arg_options = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_8, __pyx_pf_7mathics_4core_10expression_38__defaults__);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_replace_vars, __pyx_t_8) < 0) __PYX_ERR(0, 2067, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2075
 *             return var
 * 
 *     def has_symbol(self, symbol_name) -> bool:             # <<<<<<<<<<<<<<
 *         return self.name == ensure_context(symbol_name)
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2075, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_31has_symbol, 0, __pyx_n_s_Symbol_has_symbol, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__492)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_has_symbol, __pyx_t_4) < 0) __PYX_ERR(0, 2075, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2078
 *         return self.name == ensure_context(symbol_name)
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         rules = evaluation.definitions.get_ownvalues(self.name)
 *         for rule in rules:
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_33evaluate, 0, __pyx_n_s_Symbol_evaluate, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__494)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_evaluate, __pyx_t_4) < 0) __PYX_ERR(0, 2078, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2086
 *         return self
 * 
 *     def is_true(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self == SymbolTrue
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2086, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_35is_true, 0, __pyx_n_s_Symbol_is_true, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__496)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_true, __pyx_t_8) < 0) __PYX_ERR(0, 2086, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2089
 *         return self == SymbolTrue
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.name in system_symbols(
 *             "Pi", "E", "EulerGamma", "GoldenRatio", "MachinePrecision", "Catalan"
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2089, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_37is_numeric, 0, __pyx_n_s_Symbol_is_numeric, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__498)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_numeric, __pyx_t_4) < 0) __PYX_ERR(0, 2089, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2094
 *         )
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Symbol", self.name))  # to distinguish from String
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_39__hash__, 0, __pyx_n_s_Symbol___hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__500)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_hash, __pyx_t_4) < 0) __PYX_ERR(0, 2094, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2097
 *         return hash(("Symbol", self.name))  # to distinguish from String
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(b"System`Symbol>" + self.name.encode("utf8"))
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, Py_None) < 0) __PYX_ERR(0, 2097, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_41user_hash, 0, __pyx_n_s_Symbol_user_hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__502)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_user_hash, __pyx_t_8) < 0) __PYX_ERR(0, 2097, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2100
 *         update(b"System`Symbol>" + self.name.encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.name, self.sympy_dummy)
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Symbol_43__getnewargs__, 0, __pyx_n_s_Symbol___getnewargs, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__504)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_getnewargs, __pyx_t_8) < 0) __PYX_ERR(0, 2100, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":1966
 * 
 * 
 * class Symbol(Atom):             # <<<<<<<<<<<<<<
 *     name: str
 *     sympy_dummy: Any
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_Symbol, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Symbol, __pyx_t_8) < 0) __PYX_ERR(0, 1966, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2105
 * 
 * # Some common Symbols. This list is sorted in alpabetic order.
 * SymbolAborted = Symbol("$Aborted")             # <<<<<<<<<<<<<<
 * SymbolAssociation = Symbol("Association")
 * SymbolByteArray = Symbol("ByteArray")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__505, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolAborted, __pyx_t_6) < 0) __PYX_ERR(0, 2105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2106
 * # Some common Symbols. This list is sorted in alpabetic order.
 * SymbolAborted = Symbol("$Aborted")
 * SymbolAssociation = Symbol("Association")             # <<<<<<<<<<<<<<
 * SymbolByteArray = Symbol("ByteArray")
 * SymbolComplexInfinity = Symbol("ComplexInfinity")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__506, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolAssociation, __pyx_t_2) < 0) __PYX_ERR(0, 2106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2107
 * SymbolAborted = Symbol("$Aborted")
 * SymbolAssociation = Symbol("Association")
 * SymbolByteArray = Symbol("ByteArray")             # <<<<<<<<<<<<<<
 * SymbolComplexInfinity = Symbol("ComplexInfinity")
 * SymbolDirectedInfinity = Symbol("DirectedInfinity")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__507, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolByteArray, __pyx_t_6) < 0) __PYX_ERR(0, 2107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2108
 * SymbolAssociation = Symbol("Association")
 * SymbolByteArray = Symbol("ByteArray")
 * SymbolComplexInfinity = Symbol("ComplexInfinity")             # <<<<<<<<<<<<<<
 * SymbolDirectedInfinity = Symbol("DirectedInfinity")
 * SymbolFailed = Symbol("$Failed")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__508, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolComplexInfinity, __pyx_t_2) < 0) __PYX_ERR(0, 2108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2109
 * SymbolByteArray = Symbol("ByteArray")
 * SymbolComplexInfinity = Symbol("ComplexInfinity")
 * SymbolDirectedInfinity = Symbol("DirectedInfinity")             # <<<<<<<<<<<<<<
 * SymbolFailed = Symbol("$Failed")
 * SymbolFalse = Symbol("False")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__509, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolDirectedInfinity, __pyx_t_6) < 0) __PYX_ERR(0, 2109, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2110
 * SymbolComplexInfinity = Symbol("ComplexInfinity")
 * SymbolDirectedInfinity = Symbol("DirectedInfinity")
 * SymbolFailed = Symbol("$Failed")             # <<<<<<<<<<<<<<
 * SymbolFalse = Symbol("False")
 * SymbolInfinity = Symbol("Infinity")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__510, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolFailed, __pyx_t_2) < 0) __PYX_ERR(0, 2110, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2111
 * SymbolDirectedInfinity = Symbol("DirectedInfinity")
 * SymbolFailed = Symbol("$Failed")
 * SymbolFalse = Symbol("False")             # <<<<<<<<<<<<<<
 * SymbolInfinity = Symbol("Infinity")
 * SymbolList = Symbol("List")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__511, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolFalse, __pyx_t_6) < 0) __PYX_ERR(0, 2111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2112
 * SymbolFailed = Symbol("$Failed")
 * SymbolFalse = Symbol("False")
 * SymbolInfinity = Symbol("Infinity")             # <<<<<<<<<<<<<<
 * SymbolList = Symbol("List")
 * SymbolMakeBoxes = Symbol("MakeBoxes")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__512, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolInfinity, __pyx_t_2) < 0) __PYX_ERR(0, 2112, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2113
 * SymbolFalse = Symbol("False")
 * SymbolInfinity = Symbol("Infinity")
 * SymbolList = Symbol("List")             # <<<<<<<<<<<<<<
 * SymbolMakeBoxes = Symbol("MakeBoxes")
 * SymbolN = Symbol("N")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__513, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolList, __pyx_t_6) < 0) __PYX_ERR(0, 2113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2114
 * SymbolInfinity = Symbol("Infinity")
 * SymbolList = Symbol("List")
 * SymbolMakeBoxes = Symbol("MakeBoxes")             # <<<<<<<<<<<<<<
 * SymbolN = Symbol("N")
 * SymbolNull = Symbol("Null")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__514, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolMakeBoxes, __pyx_t_2) < 0) __PYX_ERR(0, 2114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2115
 * SymbolList = Symbol("List")
 * SymbolMakeBoxes = Symbol("MakeBoxes")
 * SymbolN = Symbol("N")             # <<<<<<<<<<<<<<
 * SymbolNull = Symbol("Null")
 * SymbolRule = Symbol("Rule")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__515, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolN, __pyx_t_6) < 0) __PYX_ERR(0, 2115, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2116
 * SymbolMakeBoxes = Symbol("MakeBoxes")
 * SymbolN = Symbol("N")
 * SymbolNull = Symbol("Null")             # <<<<<<<<<<<<<<
 * SymbolRule = Symbol("Rule")
 * SymbolSequence = Symbol("Sequence")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__516, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolNull, __pyx_t_2) < 0) __PYX_ERR(0, 2116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2117
 * SymbolN = Symbol("N")
 * SymbolNull = Symbol("Null")
 * SymbolRule = Symbol("Rule")             # <<<<<<<<<<<<<<
 * SymbolSequence = Symbol("Sequence")
 * SymbolTrue = Symbol("True")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__517, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolRule, __pyx_t_6) < 0) __PYX_ERR(0, 2117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2118
 * SymbolNull = Symbol("Null")
 * SymbolRule = Symbol("Rule")
 * SymbolSequence = Symbol("Sequence")             # <<<<<<<<<<<<<<
 * SymbolTrue = Symbol("True")
 * SymbolUndefined = Symbol("Undefined")
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__518, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolSequence, __pyx_t_2) < 0) __PYX_ERR(0, 2118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2119
 * SymbolRule = Symbol("Rule")
 * SymbolSequence = Symbol("Sequence")
 * SymbolTrue = Symbol("True")             # <<<<<<<<<<<<<<
 * SymbolUndefined = Symbol("Undefined")
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__519, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolTrue, __pyx_t_6) < 0) __PYX_ERR(0, 2119, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2120
 * SymbolSequence = Symbol("Sequence")
 * SymbolTrue = Symbol("True")
 * SymbolUndefined = Symbol("Undefined")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__520, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolUndefined, __pyx_t_2) < 0) __PYX_ERR(0, 2120, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2123
 * 
 * 
 * @lru_cache(maxsize=1024)             # <<<<<<<<<<<<<<
 * def from_mpmath(value, prec=None):
 *     "Converts mpf or mpc to Number."
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_lru_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_maxsize, __pyx_int_1024) < 0) __PYX_ERR(0, 2123, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2124
 * 
 * @lru_cache(maxsize=1024)
 * def from_mpmath(value, prec=None):             # <<<<<<<<<<<<<<
 *     "Converts mpf or mpc to Number."
 *     if isinstance(value, mpmath.mpf):
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_15from_mpmath, 0, __pyx_n_s_from_mpmath, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__522)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_tuple__523);

  /* "mathics/core/expression.py":2123
 * 
 * 
 * @lru_cache(maxsize=1024)             # <<<<<<<<<<<<<<
 * def from_mpmath(value, prec=None):
 *     "Converts mpf or mpc to Number."
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_from_mpmath, __pyx_t_2) < 0) __PYX_ERR(0, 2124, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2142
 * 
 * 
 * class Number(Atom):             # <<<<<<<<<<<<<<
 *     def __str__(self) -> str:
 *         return str(self.value)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Atom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_6, __pyx_n_s_Number, __pyx_n_s_Number, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "mathics/core/expression.py":2143
 * 
 * class Number(Atom):
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2143, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Number_1__str__, 0, __pyx_n_s_Number___str, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__525)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_str, __pyx_t_4) < 0) __PYX_ERR(0, 2143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2146
 *         return str(self.value)
 * 
 *     def is_numeric(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2146, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6Number_3is_numeric, 0, __pyx_n_s_Number_is_numeric, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__527)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_numeric, __pyx_t_8) < 0) __PYX_ERR(0, 2146, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2142
 * 
 * 
 * class Number(Atom):             # <<<<<<<<<<<<<<
 *     def __str__(self) -> str:
 *         return str(self.value)
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Number, __pyx_t_6, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Number, __pyx_t_8) < 0) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2150
 * 
 * 
 * def _ExponentFunction(value):             # <<<<<<<<<<<<<<
 *     n = value.get_int_value()
 *     if -5 <= n <= 5:
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_17_ExponentFunction, 0, __pyx_n_s_ExponentFunction, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__529)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ExponentFunction, __pyx_t_6) < 0) __PYX_ERR(0, 2150, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2158
 * 
 * 
 * def _NumberFormat(man, base, exp, options):             # <<<<<<<<<<<<<<
 *     if exp.get_string_value():
 *         if options["_Form"] in (
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_19_NumberFormat, 0, __pyx_n_s_NumberFormat, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__531)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NumberFormat, __pyx_t_6) < 0) __PYX_ERR(0, 2158, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2181
 * 
 * _number_form_options = {
 *     "DigitBlock": [0, 0],             # <<<<<<<<<<<<<<
 *     "ExponentFunction": _ExponentFunction,
 *     "ExponentStep": 1,
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_DigitBlock, __pyx_t_2) < 0) __PYX_ERR(0, 2181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2182
 * _number_form_options = {
 *     "DigitBlock": [0, 0],
 *     "ExponentFunction": _ExponentFunction,             # <<<<<<<<<<<<<<
 *     "ExponentStep": 1,
 *     "NumberFormat": _NumberFormat,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ExponentFunction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_ExponentFunction_2, __pyx_t_2) < 0) __PYX_ERR(0, 2181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_ExponentStep, __pyx_int_1) < 0) __PYX_ERR(0, 2181, __pyx_L1_error)

  /* "mathics/core/expression.py":2184
 *     "ExponentFunction": _ExponentFunction,
 *     "ExponentStep": 1,
 *     "NumberFormat": _NumberFormat,             # <<<<<<<<<<<<<<
 *     "NumberPadding": ["", "0"],
 *     "NumberPoint": ".",
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_NumberFormat); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_NumberFormat_2, __pyx_t_2) < 0) __PYX_ERR(0, 2181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2185
 *     "ExponentStep": 1,
 *     "NumberFormat": _NumberFormat,
 *     "NumberPadding": ["", "0"],             # <<<<<<<<<<<<<<
 *     "NumberPoint": ".",
 *     "NumberSigns": ["-", ""],
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_u__3);
  __Pyx_GIVEREF(__pyx_kp_u__3);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u__3);
  __Pyx_INCREF(__pyx_kp_u_0);
  __Pyx_GIVEREF(__pyx_kp_u_0);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u_0);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_NumberPadding, __pyx_t_2) < 0) __PYX_ERR(0, 2181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_NumberPoint, __pyx_kp_u__88) < 0) __PYX_ERR(0, 2181, __pyx_L1_error)

  /* "mathics/core/expression.py":2187
 *     "NumberPadding": ["", "0"],
 *     "NumberPoint": ".",
 *     "NumberSigns": ["-", ""],             # <<<<<<<<<<<<<<
 *     "SignPadding": False,
 *     "NumberMultiplier": "\u00d7",
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_u__532);
  __Pyx_GIVEREF(__pyx_kp_u__532);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u__532);
  __Pyx_INCREF(__pyx_kp_u__3);
  __Pyx_GIVEREF(__pyx_kp_u__3);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u__3);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_NumberSigns, __pyx_t_2) < 0) __PYX_ERR(0, 2181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2188
 *     "NumberPoint": ".",
 *     "NumberSigns": ["-", ""],
 *     "SignPadding": False,             # <<<<<<<<<<<<<<
 *     "NumberMultiplier": "\u00d7",
 * }
 */
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_SignPadding, Py_False) < 0) __PYX_ERR(0, 2181, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_NumberMultiplier, __pyx_kp_u__97) < 0) __PYX_ERR(0, 2181, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_number_form_options, __pyx_t_6) < 0) __PYX_ERR(0, 2180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2193
 * 
 * 
 * class Integer(Number):             # <<<<<<<<<<<<<<
 *     value: int
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Number); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_2, __pyx_n_s_Integer, __pyx_n_s_Integer, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "mathics/core/expression.py":2196
 *     value: int
 * 
 *     def __new__(cls, value) -> "Integer":             # <<<<<<<<<<<<<<
 *         n = int(value)
 *         self = super(Integer, cls).__new__(cls)
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_Integer) < 0) __PYX_ERR(0, 2196, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Integer___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__534)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_new_2, __pyx_t_1) < 0) __PYX_ERR(0, 2196, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2202
 *         return self
 * 
 *     @lru_cache()             # <<<<<<<<<<<<<<
 *     def __init__(self, value) -> "Integer":
 *         super().__init__()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_lru_cache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/core/expression.py":2203
 * 
 *     @lru_cache()
 *     def __init__(self, value) -> "Integer":             # <<<<<<<<<<<<<<
 *         super().__init__()
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_Integer) < 0) __PYX_ERR(0, 2203, __pyx_L1_error)
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_3__init__, 0, __pyx_n_s_Integer___init, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__536)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_t_3);
  PyList_Append(__pyx_t_8, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_5);
  __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_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_1)) __PYX_ERR(0, 2202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 2203, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2206
 *         super().__init__()
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2206, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_5boxes_to_text, 0, __pyx_n_s_Integer_boxes_to_text, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__538)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_boxes_to_text, __pyx_t_4) < 0) __PYX_ERR(0, 2206, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2209
 *         return str(self.value)
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("MathMLForm").boxes_to_mathml(**options)
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2209, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_7boxes_to_mathml, 0, __pyx_n_s_Integer_boxes_to_mathml, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__540)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_boxes_to_mathml, __pyx_t_1) < 0) __PYX_ERR(0, 2209, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2212
 *         return self.make_boxes("MathMLForm").boxes_to_mathml(**options)
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2212, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_9boxes_to_tex, 0, __pyx_n_s_Integer_boxes_to_tex, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__542)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_boxes_to_tex, __pyx_t_4) < 0) __PYX_ERR(0, 2212, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2215
 *         return str(self.value)
 * 
 *     def make_boxes(self, form) -> "String":             # <<<<<<<<<<<<<<
 *         return String(str(self.value))
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_String) < 0) __PYX_ERR(0, 2215, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_11make_boxes, 0, __pyx_n_s_Integer_make_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__544)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_make_boxes, __pyx_t_1) < 0) __PYX_ERR(0, 2215, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2218
 *         return String(str(self.value))
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.make_boxes(f.get_name())
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_13atom_to_boxes, 0, __pyx_n_s_Integer_atom_to_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__546)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_atom_to_boxes, __pyx_t_1) < 0) __PYX_ERR(0, 2218, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2221
 *         return self.make_boxes(f.get_name())
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.value)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2221, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_15default_format, 0, __pyx_n_s_Integer_default_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__548)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_default_format, __pyx_t_4) < 0) __PYX_ERR(0, 2221, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2224
 *         return str(self.value)
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return sympy.Integer(self.value)
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_17to_sympy, 0, __pyx_n_s_Integer_to_sympy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__550)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_sympy, __pyx_t_4) < 0) __PYX_ERR(0, 2224, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2227
 *         return sympy.Integer(self.value)
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_19to_mpmath, 0, __pyx_n_s_Integer_to_mpmath, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__552)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_mpmath, __pyx_t_4) < 0) __PYX_ERR(0, 2227, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2230
 *         return mpmath.mpf(self.value)
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_21to_python, 0, __pyx_n_s_Integer_to_python, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__554)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_python, __pyx_t_4) < 0) __PYX_ERR(0, 2230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2233
 *         return self.value
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_typing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Union); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_tuple__558); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_1) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_23round, 0, __pyx_n_s_Integer_round, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__556)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__557);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_round, __pyx_t_1) < 0) __PYX_ERR(0, 2233, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2239
 *             return PrecisionReal(sympy.Float(self.value, d))
 * 
 *     def get_int_value(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_int_2) < 0) __PYX_ERR(0, 2239, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_25get_int_value, 0, __pyx_n_s_Integer_get_int_value, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__560)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_int_value, __pyx_t_4) < 0) __PYX_ERR(0, 2239, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2242
 *         return self.value
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, Integer) and self.value == other.value
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2242, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_27sameQ, 0, __pyx_n_s_Integer_sameQ, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__562)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_sameQ, __pyx_t_1) < 0) __PYX_ERR(0, 2242, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2246
 *         return isinstance(other, Integer) and self.value == other.value
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_29evaluate, 0, __pyx_n_s_Integer_evaluate, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__564)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_evaluate, __pyx_t_1) < 0) __PYX_ERR(0, 2246, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2250
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_31get_sort_key, 0, __pyx_n_s_Integer_get_sort_key, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__566)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  PyList_Append(__pyx_t_8, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__567);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_sort_key, __pyx_t_1) < 0) __PYX_ERR(0, 2250, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2256
 *             return [0, 0, self.value, 0, 1]
 * 
 *     def do_copy(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_Integer) < 0) __PYX_ERR(0, 2256, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_33do_copy, 0, __pyx_n_s_Integer_do_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__569)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_do_copy, __pyx_t_4) < 0) __PYX_ERR(0, 2256, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2259
 *         return Integer(self.value)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Integer", self.value))
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_35__hash__, 0, __pyx_n_s_Integer___hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__571)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_hash, __pyx_t_4) < 0) __PYX_ERR(0, 2259, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2262
 *         return hash(("Integer", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         update(b"System`Integer>" + str(self.value).encode("utf8"))
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_37user_hash, 0, __pyx_n_s_Integer_user_hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__573)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_user_hash, __pyx_t_4) < 0) __PYX_ERR(0, 2262, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2265
 *         update(b"System`Integer>" + str(self.value).encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_39__getnewargs__, 0, __pyx_n_s_Integer___getnewargs, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__575)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_getnewargs, __pyx_t_4) < 0) __PYX_ERR(0, 2265, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2268
 *         return (self.value,)
 * 
 *     def __neg__(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(-self.value)
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_Integer) < 0) __PYX_ERR(0, 2268, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_41__neg__, 0, __pyx_n_s_Integer___neg, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__577)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_neg, __pyx_t_1) < 0) __PYX_ERR(0, 2268, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2272
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2272, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Integer_43is_zero, 0, __pyx_n_s_Integer_is_zero, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__579)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2271
 *         return Integer(-self.value)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_zero(self) -> bool:
 *         return self.value == 0
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_zero, __pyx_t_1) < 0) __PYX_ERR(0, 2272, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2193
 * 
 * 
 * class Integer(Number):             # <<<<<<<<<<<<<<
 *     value: int
 * 
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_Integer, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_8, __pyx_t_1) < 0) __PYX_ERR(0, 2193, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Integer, __pyx_t_1) < 0) __PYX_ERR(0, 2193, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2276
 * 
 * 
 * Integer0 = Integer(0)             # <<<<<<<<<<<<<<
 * Integer1 = Integer(1)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__580, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Integer0, __pyx_t_6) < 0) __PYX_ERR(0, 2276, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2277
 * 
 * Integer0 = Integer(0)
 * Integer1 = Integer(1)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Integer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__581, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Integer1, __pyx_t_2) < 0) __PYX_ERR(0, 2277, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2280
 * 
 * 
 * class Rational(Number):             # <<<<<<<<<<<<<<
 *     @lru_cache()
 *     def __new__(cls, numerator, denominator=1) -> "Rational":
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Number); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_6, __pyx_n_s_Rational, __pyx_n_s_Rational, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "mathics/core/expression.py":2281
 * 
 * class Rational(Number):
 *     @lru_cache()             # <<<<<<<<<<<<<<
 *     def __new__(cls, numerator, denominator=1) -> "Rational":
 *         self = super().__new__(cls)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_lru_cache); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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, 2281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/core/expression.py":2282
 * class Rational(Number):
 *     @lru_cache()
 *     def __new__(cls, numerator, denominator=1) -> "Rational":             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         self.value = sympy.Rational(numerator, denominator)
 */
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_Rational) < 0) __PYX_ERR(0, 2282, __pyx_L1_error)
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Rational___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__583)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_5);
  PyList_Append(__pyx_t_1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__584);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3);
  __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_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_new_2, __pyx_t_8) < 0) __PYX_ERR(0, 2282, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2287
 *         return self
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.format(evaluation, f.get_name())
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_3atom_to_boxes, 0, __pyx_n_s_Rational_atom_to_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__586)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_atom_to_boxes, __pyx_t_8) < 0) __PYX_ERR(0, 2287, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2290
 *         return self.format(evaluation, f.get_name())
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_5to_sympy, 0, __pyx_n_s_Rational_to_sympy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__588)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_sympy, __pyx_t_8) < 0) __PYX_ERR(0, 2290, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2293
 *         return self.value
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_7to_mpmath, 0, __pyx_n_s_Rational_to_mpmath, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__590)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_mpmath, __pyx_t_8) < 0) __PYX_ERR(0, 2293, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2296
 *         return mpmath.mpf(self.value)
 * 
 *     def to_python(self, *args, **kwargs) -> float:             # <<<<<<<<<<<<<<
 *         return float(self.value)
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_float) < 0) __PYX_ERR(0, 2296, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_9to_python, 0, __pyx_n_s_Rational_to_python, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__592)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_python, __pyx_t_4) < 0) __PYX_ERR(0, 2296, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2299
 *         return float(self.value)
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_typing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_Union); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_tuple__558); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_8) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_11round, 0, __pyx_n_s_Rational_round, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__594)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__595);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_round, __pyx_t_8) < 0) __PYX_ERR(0, 2299, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2305
 *             return PrecisionReal(self.value.n(d))
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, Rational) and self.value == other.value
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2305, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_13sameQ, 0, __pyx_n_s_Rational_sameQ, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__597)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_sameQ, __pyx_t_4) < 0) __PYX_ERR(0, 2305, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2309
 *         return isinstance(other, Rational) and self.value == other.value
 * 
 *     def numerator(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value.as_numer_denom()[0])
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_Integer) < 0) __PYX_ERR(0, 2309, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_15numerator, 0, __pyx_n_s_Rational_numerator, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__599)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_numerator, __pyx_t_8) < 0) __PYX_ERR(0, 2309, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2312
 *         return Integer(self.value.as_numer_denom()[0])
 * 
 *     def denominator(self) -> "Integer":             # <<<<<<<<<<<<<<
 *         return Integer(self.value.as_numer_denom()[1])
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Integer) < 0) __PYX_ERR(0, 2312, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_17denominator, 0, __pyx_n_s_Rational_denominator, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__601)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_denominator, __pyx_t_4) < 0) __PYX_ERR(0, 2312, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2315
 *         return Integer(self.value.as_numer_denom()[1])
 * 
 *     def do_format(self, evaluation, form) -> "Expression":             # <<<<<<<<<<<<<<
 *         assert fully_qualified_symbol_name(form)
 *         if form == "System`FullForm":
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 2315, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_19do_format, 0, __pyx_n_s_Rational_do_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__603)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_do_format, __pyx_t_8) < 0) __PYX_ERR(0, 2315, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2334
 *             return result.do_format(evaluation, form)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "Rational[%s, %s]" % self.value.as_numer_denom()
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2334, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_21default_format, 0, __pyx_n_s_Rational_default_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__605)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_default_format, __pyx_t_4) < 0) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2337
 *         return "Rational[%s, %s]" % self.value.as_numer_denom()
 * 
 *     def evaluate(self, evaluation) -> "Rational":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_Rational) < 0) __PYX_ERR(0, 2337, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_23evaluate, 0, __pyx_n_s_Rational_evaluate, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__607)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_evaluate, __pyx_t_8) < 0) __PYX_ERR(0, 2337, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2341
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_25get_sort_key, 0, __pyx_n_s_Rational_get_sort_key, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__609)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_t_8);
  PyList_Append(__pyx_t_1, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__610);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_sort_key, __pyx_t_8) < 0) __PYX_ERR(0, 2341, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2348
 *             return [0, 0, sympy.Float(self.value), 0, 1]
 * 
 *     def do_copy(self) -> "Rational":             # <<<<<<<<<<<<<<
 *         return Rational(self.value)
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Rational) < 0) __PYX_ERR(0, 2348, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_27do_copy, 0, __pyx_n_s_Rational_do_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__612)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_do_copy, __pyx_t_4) < 0) __PYX_ERR(0, 2348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2351
 *         return Rational(self.value)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Rational", self.value))
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_29__hash__, 0, __pyx_n_s_Rational___hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__614)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_hash, __pyx_t_4) < 0) __PYX_ERR(0, 2351, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2354
 *         return hash(("Rational", self.value))
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(
 *             b"System`Rational>" + ("%s>%s" % self.value.as_numer_denom()).encode("utf8")
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, Py_None) < 0) __PYX_ERR(0, 2354, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_31user_hash, 0, __pyx_n_s_Rational_user_hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__616)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_user_hash, __pyx_t_8) < 0) __PYX_ERR(0, 2354, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2359
 *         )
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.numerator().get_int_value(), self.denominator().get_int_value())
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_33__getnewargs__, 0, __pyx_n_s_Rational___getnewargs, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__618)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_getnewargs, __pyx_t_8) < 0) __PYX_ERR(0, 2359, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2362
 *         return (self.numerator().get_int_value(), self.denominator().get_int_value())
 * 
 *     def __neg__(self) -> "Rational":             # <<<<<<<<<<<<<<
 *         return Rational(
 *             -self.numerator().get_int_value(), self.denominator().get_int_value()
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Rational) < 0) __PYX_ERR(0, 2362, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_35__neg__, 0, __pyx_n_s_Rational___neg, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__620)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_neg, __pyx_t_4) < 0) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2368
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return (
 *             self.numerator().is_zero
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2368, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_8Rational_37is_zero, 0, __pyx_n_s_Rational_is_zero, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__622)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2367
 *         )
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_zero(self) -> bool:
 *         return (
 */
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_zero, __pyx_t_4) < 0) __PYX_ERR(0, 2368, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2280
 * 
 * 
 * class Rational(Number):             # <<<<<<<<<<<<<<
 *     @lru_cache()
 *     def __new__(cls, numerator, denominator=1) -> "Rational":
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Rational, __pyx_t_6, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_1, __pyx_t_4) < 0) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Rational, __pyx_t_4) < 0) __PYX_ERR(0, 2280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2374
 * 
 * 
 * RationalOneHalf = Rational(1, 2)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Rational); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__623, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RationalOneHalf, __pyx_t_2) < 0) __PYX_ERR(0, 2374, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2377
 * 
 * 
 * class Real(Number):             # <<<<<<<<<<<<<<
 *     def __new__(cls, value, p=None) -> "Real":
 *         if isinstance(value, str):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Number); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_6, __pyx_n_s_Real, __pyx_n_s_Real, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "mathics/core/expression.py":2378
 * 
 * class Real(Number):
 *     def __new__(cls, value, p=None) -> "Real":             # <<<<<<<<<<<<<<
 *         if isinstance(value, str):
 *             value = str(value)
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_Real) < 0) __PYX_ERR(0, 2378, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Real___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__625)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__626);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_new_2, __pyx_t_8) < 0) __PYX_ERR(0, 2378, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2402
 *             return PrecisionReal.__new__(PrecisionReal, value)
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`OutputForm").boxes_to_text(**options)
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2402, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_3boxes_to_text, 0, __pyx_n_s_Real_boxes_to_text, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__628)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_boxes_to_text, __pyx_t_1) < 0) __PYX_ERR(0, 2402, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2405
 *         return self.make_boxes("System`OutputForm").boxes_to_text(**options)
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`MathMLForm").boxes_to_mathml(**options)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2405, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_5boxes_to_mathml, 0, __pyx_n_s_Real_boxes_to_mathml, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__630)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_boxes_to_mathml, __pyx_t_8) < 0) __PYX_ERR(0, 2405, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2408
 *         return self.make_boxes("System`MathMLForm").boxes_to_mathml(**options)
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return self.make_boxes("System`TeXForm").boxes_to_tex(**options)
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2408, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_7boxes_to_tex, 0, __pyx_n_s_Real_boxes_to_tex, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__632)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_boxes_to_tex, __pyx_t_1) < 0) __PYX_ERR(0, 2408, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2411
 *         return self.make_boxes("System`TeXForm").boxes_to_tex(**options)
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.make_boxes(f.get_name())
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_9atom_to_boxes, 0, __pyx_n_s_Real_atom_to_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__634)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_atom_to_boxes, __pyx_t_1) < 0) __PYX_ERR(0, 2411, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2414
 *         return self.make_boxes(f.get_name())
 * 
 *     def evaluate(self, evaluation) -> "Real":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_Real) < 0) __PYX_ERR(0, 2414, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_11evaluate, 0, __pyx_n_s_Real_evaluate, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__636)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_evaluate, __pyx_t_8) < 0) __PYX_ERR(0, 2414, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2418
 *         return self
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_13get_sort_key, 0, __pyx_n_s_Real_get_sort_key, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__638)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_t_8);
  PyList_Append(__pyx_t_4, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__639);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_sort_key, __pyx_t_8) < 0) __PYX_ERR(0, 2418, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2423
 *         return [0, 0, self.value, 0, 1]
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         if isinstance(other, Real):
 *             # MMA Docs: "Approximate numbers that differ in their last seven
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2423, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_15__eq__, 0, __pyx_n_s_Real___eq, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__641)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_eq, __pyx_t_1) < 0) __PYX_ERR(0, 2423, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2436
 *             return self.get_sort_key() == other.get_sort_key()
 * 
 *     def __ne__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         # Real is a total order
 *         return not (self == other)
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2436, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_17__ne__, 0, __pyx_n_s_Real___ne, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__643)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_ne, __pyx_t_8) < 0) __PYX_ERR(0, 2436, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2440
 *         return not (self == other)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_19__hash__, 0, __pyx_n_s_Real___hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__645)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_hash, __pyx_t_8) < 0) __PYX_ERR(0, 2440, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2445
 *         return hash(("Real", self.to_sympy().n(dps(_prec))))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # ignore last 7 binary digits when hashing
 *         _prec = self.get_precision()
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_21user_hash, 0, __pyx_n_s_Real_user_hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__647)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_user_hash, __pyx_t_8) < 0) __PYX_ERR(0, 2445, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2450
 *         update(b"System`Real>" + str(self.to_sympy().n(dps(_prec))).encode("utf8"))
 * 
 *     def get_atom_name(self) -> str:             # <<<<<<<<<<<<<<
 *         return "Real"
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2450, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_4Real_23get_atom_name, 0, __pyx_n_s_Real_get_atom_name, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__649)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_atom_name, __pyx_t_1) < 0) __PYX_ERR(0, 2450, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2377
 * 
 * 
 * class Real(Number):             # <<<<<<<<<<<<<<
 *     def __new__(cls, value, p=None) -> "Real":
 *         if isinstance(value, str):
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Real, __pyx_t_6, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_4, __pyx_t_1) < 0) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Real, __pyx_t_1) < 0) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2454
 * 
 * 
 * class MachineReal(Real):             # <<<<<<<<<<<<<<
 *     """
 *     Machine precision real number.
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Real); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_2, __pyx_n_s_MachineReal, __pyx_n_s_MachineReal, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, __pyx_kp_s_Machine_precision_real_number_S); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "mathics/core/expression.py":2463
 *     value: float
 * 
 *     def __new__(cls, value) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         self = Number.__new__(cls)
 *         self.value = float(value)
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_MachineReal) < 0) __PYX_ERR(0, 2463, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_MachineReal___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__651)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_new_2, __pyx_t_4) < 0) __PYX_ERR(0, 2463, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2470
 *         return self
 * 
 *     def to_python(self, *args, **kwargs) -> float:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_float) < 0) __PYX_ERR(0, 2470, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_3to_python, 0, __pyx_n_s_MachineReal_to_python, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__653)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_python, __pyx_t_1) < 0) __PYX_ERR(0, 2470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2473
 *         return self.value
 * 
 *     def to_sympy(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return sympy.Float(self.value)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_5to_sympy, 0, __pyx_n_s_MachineReal_to_sympy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__655)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_sympy, __pyx_t_1) < 0) __PYX_ERR(0, 2473, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2476
 *         return sympy.Float(self.value)
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_7to_mpmath, 0, __pyx_n_s_MachineReal_to_mpmath, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__657)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_mpmath, __pyx_t_1) < 0) __PYX_ERR(0, 2476, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2479
 *         return mpmath.mpf(self.value)
 * 
 *     def round(self, d=None) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return self
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_MachineReal) < 0) __PYX_ERR(0, 2479, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_9round, 0, __pyx_n_s_MachineReal_round, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__659)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__660);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_round, __pyx_t_4) < 0) __PYX_ERR(0, 2479, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2482
 *         return self
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if isinstance(other, MachineReal):
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2482, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_11sameQ, 0, __pyx_n_s_MachineReal_sameQ, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__662)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_sameQ, __pyx_t_1) < 0) __PYX_ERR(0, 2482, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2490
 *         return False
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         return True
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2490, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_13is_machine_precision, 0, __pyx_n_s_MachineReal_is_machine_precision, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__664)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_machine_precision, __pyx_t_4) < 0) __PYX_ERR(0, 2490, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2493
 *         return True
 * 
 *     def get_precision(self) -> int:             # <<<<<<<<<<<<<<
 *         return machine_precision
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_int_2) < 0) __PYX_ERR(0, 2493, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_15get_precision, 0, __pyx_n_s_MachineReal_get_precision, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__666)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_precision, __pyx_t_1) < 0) __PYX_ERR(0, 2493, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2496
 *         return machine_precision
 * 
 *     def get_float_value(self, permit_complex=False) -> float:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_float) < 0) __PYX_ERR(0, 2496, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_17get_float_value, 0, __pyx_n_s_MachineReal_get_float_value, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__668)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__669);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_float_value, __pyx_t_4) < 0) __PYX_ERR(0, 2496, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2499
 *         return self.value
 * 
 *     def make_boxes(self, form):             # <<<<<<<<<<<<<<
 *         from mathics.builtin.inout import number_form
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_19make_boxes, 0, __pyx_n_s_MachineReal_make_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__671)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_make_boxes, __pyx_t_4) < 0) __PYX_ERR(0, 2499, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2509
 *         return number_form(self, n, None, None, _number_form_options)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_21__getnewargs__, 0, __pyx_n_s_MachineReal___getnewargs, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__673)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_getnewargs, __pyx_t_4) < 0) __PYX_ERR(0, 2509, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2512
 *         return (self.value,)
 * 
 *     def do_copy(self) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return MachineReal(self.value)
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_MachineReal) < 0) __PYX_ERR(0, 2512, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_23do_copy, 0, __pyx_n_s_MachineReal_do_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__675)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_do_copy, __pyx_t_1) < 0) __PYX_ERR(0, 2512, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2515
 *         return MachineReal(self.value)
 * 
 *     def __neg__(self) -> "MachineReal":             # <<<<<<<<<<<<<<
 *         return MachineReal(-self.value)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_MachineReal) < 0) __PYX_ERR(0, 2515, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_25__neg__, 0, __pyx_n_s_MachineReal___neg, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__677)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_neg, __pyx_t_4) < 0) __PYX_ERR(0, 2515, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2519
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0.0
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2519, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_27is_zero, 0, __pyx_n_s_MachineReal_is_zero, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__679)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2518
 *         return MachineReal(-self.value)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_zero(self) -> bool:
 *         return self.value == 0.0
 */
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_zero, __pyx_t_4) < 0) __PYX_ERR(0, 2519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2523
 * 
 *     @property
 *     def is_approx_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         # In WMA, Chop[10.^(-10)] == 0,
 *         # so, lets take it.
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2523, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_11MachineReal_29is_approx_zero, 0, __pyx_n_s_MachineReal_is_approx_zero, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__681)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2522
 *         return self.value == 0.0
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_approx_zero(self) -> bool:
 *         # In WMA, Chop[10.^(-10)] == 0,
 */
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_approx_zero, __pyx_t_4) < 0) __PYX_ERR(0, 2523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2454
 * 
 * 
 * class MachineReal(Real):             # <<<<<<<<<<<<<<
 *     """
 *     Machine precision real number.
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_MachineReal, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MachineReal, __pyx_t_4) < 0) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2530
 * 
 * 
 * class PrecisionReal(Real):             # <<<<<<<<<<<<<<
 *     """
 *     Arbitrary precision real number.
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_6, __pyx_n_s_PrecisionReal, __pyx_n_s_PrecisionReal, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, __pyx_kp_s_Arbitrary_precision_real_number); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "mathics/core/expression.py":2541
 *     value: sympy.Float
 * 
 *     def __new__(cls, value) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         self = Number.__new__(cls)
 *         self.value = sympy.Float(value)
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_PrecisionReal) < 0) __PYX_ERR(0, 2541, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_PrecisionReal___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__683)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_new_2, __pyx_t_1) < 0) __PYX_ERR(0, 2541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2546
 *         return self
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return float(self.value)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_3to_python, 0, __pyx_n_s_PrecisionReal_to_python, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__685)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_python, __pyx_t_1) < 0) __PYX_ERR(0, 2546, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2549
 *         return float(self.value)
 * 
 *     def to_sympy(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_5to_sympy, 0, __pyx_n_s_PrecisionReal_to_sympy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__687)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_sympy, __pyx_t_1) < 0) __PYX_ERR(0, 2549, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2552
 *         return self.value
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpf(self.value)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_7to_mpmath, 0, __pyx_n_s_PrecisionReal_to_mpmath, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__689)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_mpmath, __pyx_t_1) < 0) __PYX_ERR(0, 2552, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2555
 *         return mpmath.mpf(self.value)
 * 
 *     def round(self, d=None) -> typing.Union["MachineReal", "PrecisionReal"]:             # <<<<<<<<<<<<<<
 *         if d is None:
 *             return MachineReal(float(self.value))
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_typing); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_Union); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_tuple__558); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_t_4) < 0) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_9round, 0, __pyx_n_s_PrecisionReal_round, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__691)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__692);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_round, __pyx_t_4) < 0) __PYX_ERR(0, 2555, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2562
 *             return PrecisionReal(self.value.n(d))
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         if isinstance(other, PrecisionReal):
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2562, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_11sameQ, 0, __pyx_n_s_PrecisionReal_sameQ, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__694)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_sameQ, __pyx_t_1) < 0) __PYX_ERR(0, 2562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2570
 *         return False
 * 
 *     def get_precision(self) -> int:             # <<<<<<<<<<<<<<
 *         return self.value._prec + 1
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_int_2) < 0) __PYX_ERR(0, 2570, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_13get_precision, 0, __pyx_n_s_PrecisionReal_get_precision, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__696)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_precision, __pyx_t_4) < 0) __PYX_ERR(0, 2570, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2573
 *         return self.value._prec + 1
 * 
 *     def make_boxes(self, form):             # <<<<<<<<<<<<<<
 *         from mathics.builtin.inout import number_form
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_15make_boxes, 0, __pyx_n_s_PrecisionReal_make_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__698)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_make_boxes, __pyx_t_4) < 0) __PYX_ERR(0, 2573, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2581
 *         )
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_17__getnewargs__, 0, __pyx_n_s_PrecisionReal___getnewargs, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__700)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_getnewargs, __pyx_t_4) < 0) __PYX_ERR(0, 2581, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2584
 *         return (self.value,)
 * 
 *     def do_copy(self) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         return PrecisionReal(self.value)
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_PrecisionReal) < 0) __PYX_ERR(0, 2584, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_19do_copy, 0, __pyx_n_s_PrecisionReal_do_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__702)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_do_copy, __pyx_t_1) < 0) __PYX_ERR(0, 2584, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2587
 *         return PrecisionReal(self.value)
 * 
 *     def __neg__(self) -> "PrecisionReal":             # <<<<<<<<<<<<<<
 *         return PrecisionReal(-self.value)
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_PrecisionReal) < 0) __PYX_ERR(0, 2587, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_21__neg__, 0, __pyx_n_s_PrecisionReal___neg, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__704)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_neg, __pyx_t_4) < 0) __PYX_ERR(0, 2587, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2591
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.value == 0.0
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2591, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13PrecisionReal_23is_zero, 0, __pyx_n_s_PrecisionReal_is_zero, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__706)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2590
 *         return PrecisionReal(-self.value)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_zero(self) -> bool:
 *         return self.value == 0.0
 */
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_zero, __pyx_t_4) < 0) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2530
 * 
 * 
 * class PrecisionReal(Real):             # <<<<<<<<<<<<<<
 *     """
 *     Arbitrary precision real number.
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_PrecisionReal, __pyx_t_6, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PrecisionReal, __pyx_t_4) < 0) __PYX_ERR(0, 2530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2595
 * 
 * 
 * class Complex(Number):             # <<<<<<<<<<<<<<
 *     """
 *     Complex wraps two real-valued Numbers.
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Number); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_2, __pyx_n_s_Complex, __pyx_n_s_Complex, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, __pyx_kp_s_Complex_wraps_two_real_valued_N); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "mathics/core/expression.py":2603
 *     imag: Any
 * 
 *     def __new__(cls, real, imag):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if isinstance(real, Complex) or not isinstance(real, Number):
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Complex___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__708)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  PyList_Append(__pyx_t_4, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_new_2, __pyx_t_1) < 0) __PYX_ERR(0, 2603, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2622
 *         return self
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         return self.format(evaluation, f.get_name())
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_3atom_to_boxes, 0, __pyx_n_s_Complex_atom_to_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__710)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_atom_to_boxes, __pyx_t_1) < 0) __PYX_ERR(0, 2622, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2625
 *         return self.format(evaluation, f.get_name())
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return str(self.to_sympy())
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2625, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_5__str__, 0, __pyx_n_s_Complex___str, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__712)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_str, __pyx_t_8) < 0) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2628
 *         return str(self.to_sympy())
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return self.real.to_sympy() + sympy.I * self.imag.to_sympy()
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_7to_sympy, 0, __pyx_n_s_Complex_to_sympy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__714)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_sympy, __pyx_t_8) < 0) __PYX_ERR(0, 2628, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2631
 *         return self.real.to_sympy() + sympy.I * self.imag.to_sympy()
 * 
 *     def to_python(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         return complex(
 *             self.real.to_python(*args, **kwargs), self.imag.to_python(*args, **kwargs)
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_9to_python, 0, __pyx_n_s_Complex_to_python, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__716)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_python, __pyx_t_8) < 0) __PYX_ERR(0, 2631, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2636
 *         )
 * 
 *     def to_mpmath(self):             # <<<<<<<<<<<<<<
 *         return mpmath.mpc(self.real.to_mpmath(), self.imag.to_mpmath())
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_11to_mpmath, 0, __pyx_n_s_Complex_to_mpmath, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__718)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_to_mpmath, __pyx_t_8) < 0) __PYX_ERR(0, 2636, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2639
 *         return mpmath.mpc(self.real.to_mpmath(), self.imag.to_mpmath())
 * 
 *     def do_format(self, evaluation, form) -> "Expression":             # <<<<<<<<<<<<<<
 *         if form == "System`FullForm":
 *             return Expression(
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Expression) < 0) __PYX_ERR(0, 2639, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_13do_format, 0, __pyx_n_s_Complex_do_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__720)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_do_format, __pyx_t_1) < 0) __PYX_ERR(0, 2639, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2660
 *         return Expression("HoldForm", result).do_format(evaluation, form)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         return "Complex[%s, %s]" % (
 *             self.real.default_format(evaluation, form),
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2660, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_15default_format, 0, __pyx_n_s_Complex_default_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__722)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_default_format, __pyx_t_8) < 0) __PYX_ERR(0, 2660, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2666
 *         )
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_17get_sort_key, 0, __pyx_n_s_Complex_get_sort_key, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__724)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_t_8);
  PyList_Append(__pyx_t_4, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__725);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_sort_key, __pyx_t_8) < 0) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2672
 *             return [0, 0, self.real.get_sort_key()[2], self.imag.get_sort_key()[2], 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return (
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2672, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_19sameQ, 0, __pyx_n_s_Complex_sameQ, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__727)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_sameQ, __pyx_t_1) < 0) __PYX_ERR(0, 2672, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2680
 *         )
 * 
 *     def evaluate(self, evaluation) -> "Complex":             # <<<<<<<<<<<<<<
 *         evaluation.check_stopped()
 *         return self
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_Complex) < 0) __PYX_ERR(0, 2680, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_21evaluate, 0, __pyx_n_s_Complex_evaluate, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__729)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_evaluate, __pyx_t_8) < 0) __PYX_ERR(0, 2680, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2684
 *         return self
 * 
 *     def round(self, d=None) -> "Complex":             # <<<<<<<<<<<<<<
 *         real = self.real.round(d)
 *         imag = self.imag.round(d)
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Complex) < 0) __PYX_ERR(0, 2684, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_23round, 0, __pyx_n_s_Complex_round, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__731)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__732);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_round, __pyx_t_1) < 0) __PYX_ERR(0, 2684, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2689
 *         return Complex(real, imag)
 * 
 *     def is_machine_precision(self) -> bool:             # <<<<<<<<<<<<<<
 *         if self.real.is_machine_precision() or self.imag.is_machine_precision():
 *             return True
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2689, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_25is_machine_precision, 0, __pyx_n_s_Complex_is_machine_precision, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__734)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_machine_precision, __pyx_t_8) < 0) __PYX_ERR(0, 2689, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2694
 *         return False
 * 
 *     def get_float_value(self, permit_complex=False) -> typing.Optional[complex]:             # <<<<<<<<<<<<<<
 *         if permit_complex:
 *             real = self.real.get_float_value()
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_typing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Optional); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, ((PyObject *)(&PyComplex_Type))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_t_1) < 0) __PYX_ERR(0, 2694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_27get_float_value, 0, __pyx_n_s_Complex_get_float_value, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__736)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__737);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_float_value, __pyx_t_1) < 0) __PYX_ERR(0, 2694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2703
 *             return None
 * 
 *     def get_precision(self) -> typing.Optional[int]:             # <<<<<<<<<<<<<<
 *         real_prec = self.real.get_precision()
 *         imag_prec = self.imag.get_precision()
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_typing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_Optional); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_5, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_t_8) < 0) __PYX_ERR(0, 2703, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_29get_precision, 0, __pyx_n_s_Complex_get_precision, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__739)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_get_precision, __pyx_t_8) < 0) __PYX_ERR(0, 2703, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2710
 *         return min(real_prec, imag_prec)
 * 
 *     def do_copy(self) -> "Complex":             # <<<<<<<<<<<<<<
 *         return Complex(self.real.do_copy(), self.imag.do_copy())
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_Complex) < 0) __PYX_ERR(0, 2710, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_31do_copy, 0, __pyx_n_s_Complex_do_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__741)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_do_copy, __pyx_t_1) < 0) __PYX_ERR(0, 2710, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2713
 *         return Complex(self.real.do_copy(), self.imag.do_copy())
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("Complex", self.real, self.imag))
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_33__hash__, 0, __pyx_n_s_Complex___hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__743)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_hash, __pyx_t_1) < 0) __PYX_ERR(0, 2713, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2716
 *         return hash(("Complex", self.real, self.imag))
 * 
 *     def user_hash(self, update) -> None:             # <<<<<<<<<<<<<<
 *         update(b"System`Complex>")
 *         update(self.real)
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, Py_None) < 0) __PYX_ERR(0, 2716, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_35user_hash, 0, __pyx_n_s_Complex_user_hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__745)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_user_hash, __pyx_t_8) < 0) __PYX_ERR(0, 2716, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2721
 *         update(self.imag)
 * 
 *     def __eq__(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         if isinstance(other, Complex):
 *             return self.real == other.real and self.imag == other.imag
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2721, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_37__eq__, 0, __pyx_n_s_Complex___eq, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__747)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_eq, __pyx_t_1) < 0) __PYX_ERR(0, 2721, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2727
 *             return self.get_sort_key() == other.get_sort_key()
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.real, self.imag)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_39__getnewargs__, 0, __pyx_n_s_Complex___getnewargs, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__749)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_getnewargs, __pyx_t_1) < 0) __PYX_ERR(0, 2727, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2730
 *         return (self.real, self.imag)
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         return Complex(-self.real, -self.imag)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_41__neg__, 0, __pyx_n_s_Complex___neg, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__751)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_neg, __pyx_t_1) < 0) __PYX_ERR(0, 2730, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2734
 * 
 *     @property
 *     def is_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         return self.real.is_zero and self.imag.is_zero
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2734, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_43is_zero, 0, __pyx_n_s_Complex_is_zero, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__753)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2733
 *         return Complex(-self.real, -self.imag)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_zero(self) -> bool:
 *         return self.real.is_zero and self.imag.is_zero
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_zero, __pyx_t_1) < 0) __PYX_ERR(0, 2734, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2738
 * 
 *     @property
 *     def is_approx_zero(self) -> bool:             # <<<<<<<<<<<<<<
 *         real_zero = (
 *             self.real.is_approx_zero
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2738, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_7Complex_45is_approx_zero, 0, __pyx_n_s_Complex_is_approx_zero, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__755)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2737
 *         return self.real.is_zero and self.imag.is_zero
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def is_approx_zero(self) -> bool:
 *         real_zero = (
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_is_approx_zero, __pyx_t_1) < 0) __PYX_ERR(0, 2738, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2595
 * 
 * 
 * class Complex(Number):             # <<<<<<<<<<<<<<
 *     """
 *     Complex wraps two real-valued Numbers.
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_Complex, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_4, __pyx_t_1) < 0) __PYX_ERR(0, 2595, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Complex, __pyx_t_1) < 0) __PYX_ERR(0, 2595, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":2752
 * 
 * 
 * def encode_mathml(text: str) -> str:             # <<<<<<<<<<<<<<
 *     text = text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
 *     text = text.replace('"', "&quot;").replace(" ", "&nbsp;")
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_text, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2752, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2752, __pyx_L1_error)
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_21encode_mathml, 0, __pyx_n_s_encode_mathml, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__757)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mathml, __pyx_t_6) < 0) __PYX_ERR(0, 2752, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2760
 * 
 * TEX_REPLACE = {
 *     "{": r"\{",             # <<<<<<<<<<<<<<
 *     "}": r"\}",
 *     "_": r"\_",
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__51, __pyx_kp_u__758) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__52, __pyx_kp_u__759) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u__54, __pyx_kp_u__760) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__65, __pyx_kp_u__761) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__762, __pyx_kp_u__763) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__764, __pyx_kp_u__765) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__80, __pyx_kp_u__766) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__105, __pyx_kp_u_backslash) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__42, __pyx_kp_u_wedge) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__767, __pyx_kp_u_sim) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__768, __pyx_kp_u_vert) < 0) __PYX_ERR(0, 2760, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TEX_REPLACE, __pyx_t_6) < 0) __PYX_ERR(0, 2759, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2772
 *     "|": r"\vert{}",
 * }
 * TEX_TEXT_REPLACE = TEX_REPLACE.copy()             # <<<<<<<<<<<<<<
 * TEX_TEXT_REPLACE.update(
 *     {
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_TEX_REPLACE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TEX_TEXT_REPLACE, __pyx_t_6) < 0) __PYX_ERR(0, 2772, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2773
 * }
 * TEX_TEXT_REPLACE = TEX_REPLACE.copy()
 * TEX_TEXT_REPLACE.update(             # <<<<<<<<<<<<<<
 *     {
 *         "<": r"$<$",
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_TEX_TEXT_REPLACE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":2775
 * TEX_TEXT_REPLACE.update(
 *     {
 *         "<": r"$<$",             # <<<<<<<<<<<<<<
 *         ">": r"$>$",
 *         "~": r"$\sim$",
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__70, __pyx_kp_u__769) < 0) __PYX_ERR(0, 2775, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__69, __pyx_kp_u__770) < 0) __PYX_ERR(0, 2775, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__767, __pyx_kp_u_sim_2) < 0) __PYX_ERR(0, 2775, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__768, __pyx_kp_u_vert_2) < 0) __PYX_ERR(0, 2775, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__105, __pyx_kp_u_backslash_2) < 0) __PYX_ERR(0, 2775, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u__42, __pyx_kp_u_wedge_2) < 0) __PYX_ERR(0, 2775, __pyx_L1_error)

  /* "mathics/core/expression.py":2773
 * }
 * TEX_TEXT_REPLACE = TEX_REPLACE.copy()
 * TEX_TEXT_REPLACE.update(             # <<<<<<<<<<<<<<
 *     {
 *         "<": r"$<$",
 */
  __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":2783
 *     }
 * )
 * TEX_REPLACE_RE = re.compile("([" + "".join([re.escape(c) for c in TEX_REPLACE]) + "])")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_re); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_compile); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  { /* enter inner scope */
    __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2783, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_TEX_REPLACE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2783, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2783, __pyx_L4_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 2783, __pyx_L4_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2783, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 2783, __pyx_L4_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2783, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_10(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2783, __pyx_L4_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XGOTREF(__pyx_9genexpr40__pyx_v_7mathics_4core_10expression_c);
      __Pyx_DECREF_SET(__pyx_9genexpr40__pyx_v_7mathics_4core_10expression_c, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_re); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2783, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_escape); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2783, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_9genexpr40__pyx_v_7mathics_4core_10expression_c) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_9genexpr40__pyx_v_7mathics_4core_10expression_c);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2783, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_7, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 2783, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_9genexpr40__pyx_v_7mathics_4core_10expression_c);
    __Pyx_DECREF_SET(__pyx_9genexpr40__pyx_v_7mathics_4core_10expression_c, Py_None);
    goto __pyx_L7_exit_scope;
    __pyx_L4_error:;
    __Pyx_GOTREF(__pyx_9genexpr40__pyx_v_7mathics_4core_10expression_c);
    __Pyx_DECREF_SET(__pyx_9genexpr40__pyx_v_7mathics_4core_10expression_c, Py_None);
    goto __pyx_L1_error;
    __pyx_L7_exit_scope:;
  } /* exit inner scope */
  __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u__771, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_t_7, __pyx_kp_u__772); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TEX_REPLACE_RE, __pyx_t_7) < 0) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":2786
 * 
 * 
 * def encode_tex(text: str, in_text=False) -> str:             # <<<<<<<<<<<<<<
 *     def replace(match):
 *         c = match.group(1)
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_text, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2786, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2786, __pyx_L1_error)
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_23encode_tex, 0, __pyx_n_s_encode_tex, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__774)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__775);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_tex, __pyx_t_1) < 0) __PYX_ERR(0, 2786, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2798
 * 
 * 
 * extra_operators = set(             # <<<<<<<<<<<<<<
 *     (
 *         ",",
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__48) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__98) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__75) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__33) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__35) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__51) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__52) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__99) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__100) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__97) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__58) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__59) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__53) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__90) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_kp_u__101) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PySet_Add(__pyx_t_1, __pyx_n_u__89) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_extra_operators, __pyx_t_1) < 0) __PYX_ERR(0, 2798, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":2820
 * 
 * 
 * class String(Atom):             # <<<<<<<<<<<<<<
 *     value: str
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Atom); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_String, __pyx_n_s_String, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "mathics/core/expression.py":2823
 *     value: str
 * 
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         self.value = str(value)
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_String___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__777)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_t_8);
  PyList_Append(__pyx_t_2, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_new_2, __pyx_t_8) < 0) __PYX_ERR(0, 2823, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2828
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return '"%s"' % self.value
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2828, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_3__str__, 0, __pyx_n_s_String___str, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__779)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_str, __pyx_t_4) < 0) __PYX_ERR(0, 2828, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2831
 *         return '"%s"' % self.value
 * 
 *     def boxes_to_text(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2831, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_5boxes_to_text, 0, __pyx_n_s_String_boxes_to_text, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__781)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__782);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_boxes_to_text, __pyx_t_8) < 0) __PYX_ERR(0, 2831, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2843
 *         return value
 * 
 *     def boxes_to_mathml(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         from mathics.core.parser import is_symbol_name
 *         from mathics.builtin import builtins_by_module
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2843, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_7boxes_to_mathml, 0, __pyx_n_s_String_boxes_to_mathml, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__784)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__785);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_boxes_to_mathml, __pyx_t_4) < 0) __PYX_ERR(0, 2843, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2890
 *                 return outtext
 * 
 *     def boxes_to_tex(self, show_string_characters=False, **options) -> str:             # <<<<<<<<<<<<<<
 *         from mathics.builtin import builtins_by_module
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2890, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_9boxes_to_tex, 0, __pyx_n_s_String_boxes_to_tex, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__787)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__788);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_boxes_to_tex, __pyx_t_8) < 0) __PYX_ERR(0, 2890, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2947
 *                 return render("%s", text)
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         inner = str(self.value)
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_11atom_to_boxes, 0, __pyx_n_s_String_atom_to_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__790)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_atom_to_boxes, __pyx_t_8) < 0) __PYX_ERR(0, 2947, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2955
 *         return String('"' + inner + '"')
 * 
 *     def do_copy(self) -> "String":             # <<<<<<<<<<<<<<
 *         return String(self.value)
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_String) < 0) __PYX_ERR(0, 2955, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_13do_copy, 0, __pyx_n_s_String_do_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__792)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_do_copy, __pyx_t_4) < 0) __PYX_ERR(0, 2955, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2958
 *         return String(self.value)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value.replace("\\", "\\\\").replace('"', '\\"')
 *         return '"%s"' % value
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2958, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_15default_format, 0, __pyx_n_s_String_default_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__794)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_default_format, __pyx_t_8) < 0) __PYX_ERR(0, 2958, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2962
 *         return '"%s"' % value
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_17get_sort_key, 0, __pyx_n_s_String_get_sort_key, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__796)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_t_8);
  PyList_Append(__pyx_t_2, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_8, __pyx_tuple__797);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_get_sort_key, __pyx_t_8) < 0) __PYX_ERR(0, 2962, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2968
 *             return [0, 1, self.value, 0, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         return isinstance(other, String) and self.value == other.value
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 2968, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_19sameQ, 0, __pyx_n_s_String_sameQ, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__799)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_sameQ, __pyx_t_4) < 0) __PYX_ERR(0, 2968, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2972
 *         return isinstance(other, String) and self.value == other.value
 * 
 *     def get_string_value(self) -> str:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2972, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_21get_string_value, 0, __pyx_n_s_String_get_string_value, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__801)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_get_string_value, __pyx_t_8) < 0) __PYX_ERR(0, 2972, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2975
 *         return self.value
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_23to_sympy, 0, __pyx_n_s_String_to_sympy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__803)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_to_sympy, __pyx_t_8) < 0) __PYX_ERR(0, 2975, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2978
 *         return None
 * 
 *     def to_python(self, *args, **kwargs) -> str:             # <<<<<<<<<<<<<<
 *         if kwargs.get("string_quotes", True):
 *             return '"%s"' % self.value  # add quotes to distinguish from Symbols
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 2978, __pyx_L1_error)
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_25to_python, 0, __pyx_n_s_String_to_python, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__805)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_to_python, __pyx_t_4) < 0) __PYX_ERR(0, 2978, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2984
 *             return self.value
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("String", self.value))
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_27__hash__, 0, __pyx_n_s_String___hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__807)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_hash, __pyx_t_4) < 0) __PYX_ERR(0, 2984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2987
 *         return hash(("String", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # hashing a String is the one case where the user gets the untampered
 *         # hash value of the string's text. this corresponds to MMA behavior.
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_29user_hash, 0, __pyx_n_s_String_user_hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__809)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_user_hash, __pyx_t_4) < 0) __PYX_ERR(0, 2987, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2992
 *         update(self.value.encode("utf8"))
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_6String_31__getnewargs__, 0, __pyx_n_s_String___getnewargs, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__811)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_getnewargs, __pyx_t_4) < 0) __PYX_ERR(0, 2992, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":2820
 * 
 * 
 * class String(Atom):             # <<<<<<<<<<<<<<
 *     value: str
 * 
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_String, __pyx_t_7, __pyx_t_6, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_2, __pyx_t_4) < 0) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_String, __pyx_t_4) < 0) __PYX_ERR(0, 2820, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":2996
 * 
 * 
 * class ByteArrayAtom(Atom):             # <<<<<<<<<<<<<<
 *     value: str
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Atom); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_ByteArrayAtom, __pyx_n_s_ByteArrayAtom, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "mathics/core/expression.py":2999
 *     value: str
 * 
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls)
 *         if type(value) in (bytes, bytearray):
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_ByteArrayAtom___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__813)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  PyList_Append(__pyx_t_4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_new_2, __pyx_t_2) < 0) __PYX_ERR(0, 2999, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3011
 *         return self
 * 
 *     def __str__(self) -> str:             # <<<<<<<<<<<<<<
 *         return base64.b64encode(self.value).decode("utf8")
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 3011, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_3__str__, 0, __pyx_n_s_ByteArrayAtom___str, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__815)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_str, __pyx_t_8) < 0) __PYX_ERR(0, 3011, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":3014
 *         return base64.b64encode(self.value).decode("utf8")
 * 
 *     def boxes_to_text(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return '"' + self.__str__() + '"'
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 3014, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_5boxes_to_text, 0, __pyx_n_s_ByteArrayAtom_boxes_to_text, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__817)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_boxes_to_text, __pyx_t_2) < 0) __PYX_ERR(0, 3014, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3017
 *         return '"' + self.__str__() + '"'
 * 
 *     def boxes_to_mathml(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return encode_mathml(String('"' + self.__str__() + '"'))
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 3017, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_7boxes_to_mathml, 0, __pyx_n_s_ByteArrayAtom_boxes_to_mathml, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__819)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_boxes_to_mathml, __pyx_t_8) < 0) __PYX_ERR(0, 3017, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":3020
 *         return encode_mathml(String('"' + self.__str__() + '"'))
 * 
 *     def boxes_to_tex(self, **options) -> str:             # <<<<<<<<<<<<<<
 *         return encode_tex(String('"' + self.__str__() + '"'))
 * 
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 3020, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_9boxes_to_tex, 0, __pyx_n_s_ByteArrayAtom_boxes_to_tex, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__821)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_boxes_to_tex, __pyx_t_2) < 0) __PYX_ERR(0, 3020, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3023
 *         return encode_tex(String('"' + self.__str__() + '"'))
 * 
 *     def atom_to_boxes(self, f, evaluation):             # <<<<<<<<<<<<<<
 *         res = String('""' + self.__str__() + '""')
 *         return res
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_11atom_to_boxes, 0, __pyx_n_s_ByteArrayAtom_atom_to_boxes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__823)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_atom_to_boxes, __pyx_t_2) < 0) __PYX_ERR(0, 3023, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3027
 *         return res
 * 
 *     def do_copy(self) -> "ByteArrayAtom":             # <<<<<<<<<<<<<<
 *         return ByteArrayAtom(self.value)
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_u_ByteArrayAtom) < 0) __PYX_ERR(0, 3027, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_13do_copy, 0, __pyx_n_s_ByteArrayAtom_do_copy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__825)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_do_copy, __pyx_t_8) < 0) __PYX_ERR(0, 3027, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":3030
 *         return ByteArrayAtom(self.value)
 * 
 *     def default_format(self, evaluation, form) -> str:             # <<<<<<<<<<<<<<
 *         value = self.value
 *         return '"' + value.__str__() + '"'
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 3030, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_15default_format, 0, __pyx_n_s_ByteArrayAtom_default_format, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__827)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_default_format, __pyx_t_2) < 0) __PYX_ERR(0, 3030, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3034
 *         return '"' + value.__str__() + '"'
 * 
 *     def get_sort_key(self, pattern_sort=False):             # <<<<<<<<<<<<<<
 *         if pattern_sort:
 *             return super().get_sort_key(True)
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_17get_sort_key, 0, __pyx_n_s_ByteArrayAtom_get_sort_key, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__829)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  PyList_Append(__pyx_t_4, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__830);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_get_sort_key, __pyx_t_2) < 0) __PYX_ERR(0, 3034, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3040
 *             return [0, 1, self.value, 0, 1]
 * 
 *     def sameQ(self, other) -> bool:             # <<<<<<<<<<<<<<
 *         """Mathics SameQ"""
 *         # FIX: check
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 3040, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_19sameQ, 0, __pyx_n_s_ByteArrayAtom_sameQ, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__832)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_sameQ, __pyx_t_8) < 0) __PYX_ERR(0, 3040, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":3047
 *         return False
 * 
 *     def get_string_value(self) -> str:             # <<<<<<<<<<<<<<
 *         try:
 *             return self.value.decode("utf-8")
 */
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 3047, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_21get_string_value, 0, __pyx_n_s_ByteArrayAtom_get_string_value, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__834)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_8);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_get_string_value, __pyx_t_2) < 0) __PYX_ERR(0, 3047, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3053
 *             return None
 * 
 *     def to_sympy(self, **kwargs):             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_23to_sympy, 0, __pyx_n_s_ByteArrayAtom_to_sympy, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__836)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_to_sympy, __pyx_t_2) < 0) __PYX_ERR(0, 3053, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/core/expression.py":3056
 *         return None
 * 
 *     def to_python(self, *args, **kwargs) -> str:             # <<<<<<<<<<<<<<
 *         return self.value
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 3056, __pyx_L1_error)
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_25to_python, 0, __pyx_n_s_ByteArrayAtom_to_python, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__838)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_to_python, __pyx_t_8) < 0) __PYX_ERR(0, 3056, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":3059
 *         return self.value
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return hash(("ByteArrayAtom", self.value))
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_27__hash__, 0, __pyx_n_s_ByteArrayAtom___hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__840)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_hash, __pyx_t_8) < 0) __PYX_ERR(0, 3059, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":3062
 *         return hash(("ByteArrayAtom", self.value))
 * 
 *     def user_hash(self, update):             # <<<<<<<<<<<<<<
 *         # hashing a String is the one case where the user gets the untampered
 *         # hash value of the string's text. this corresponds to MMA behavior.
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_29user_hash, 0, __pyx_n_s_ByteArrayAtom_user_hash, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__842)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_user_hash, __pyx_t_8) < 0) __PYX_ERR(0, 3062, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":3067
 *         update(self.value)
 * 
 *     def __getnewargs__(self):             # <<<<<<<<<<<<<<
 *         return (self.value,)
 * 
 */
  __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_13ByteArrayAtom_31__getnewargs__, 0, __pyx_n_s_ByteArrayAtom___getnewargs, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__844)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_getnewargs, __pyx_t_8) < 0) __PYX_ERR(0, 3067, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/core/expression.py":2996
 * 
 * 
 * class ByteArrayAtom(Atom):             # <<<<<<<<<<<<<<
 *     value: str
 * 
 */
  __pyx_t_8 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_ByteArrayAtom, __pyx_t_1, __pyx_t_6, NULL, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_4, __pyx_t_8) < 0) __PYX_ERR(0, 2996, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ByteArrayAtom, __pyx_t_8) < 0) __PYX_ERR(0, 2996, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3071
 * 
 * 
 * class StringFromPython(String):             # <<<<<<<<<<<<<<
 *     def __new__(cls, value):
 *         self = super().__new__(cls, value)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_String); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_StringFromPython, __pyx_n_s_StringFromPython, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);

  /* "mathics/core/expression.py":3072
 * 
 * class StringFromPython(String):
 *     def __new__(cls, value):             # <<<<<<<<<<<<<<
 *         self = super().__new__(cls, value)
 *         if isinstance(value, sympy.NumberSymbol):
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_16StringFromPython_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_StringFromPython___new, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__846)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_t_4);
  PyList_Append(__pyx_t_8, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_new_2, __pyx_t_4) < 0) __PYX_ERR(0, 3072, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":3071
 * 
 * 
 * class StringFromPython(String):             # <<<<<<<<<<<<<<
 *     def __new__(cls, value):
 *         self = super().__new__(cls, value)
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_StringFromPython, __pyx_t_7, __pyx_t_6, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_8, __pyx_t_4) < 0) __PYX_ERR(0, 3071, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_StringFromPython, __pyx_t_4) < 0) __PYX_ERR(0, 3071, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":3084
 * 
 * 
 * def get_default_value(name, evaluation, k=None, n=None):             # <<<<<<<<<<<<<<
 *     pos = []
 *     if k is not None:
 */
  __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_25get_default_value, 0, __pyx_n_s_get_default_value, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__848)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__849);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_default_value, __pyx_t_7) < 0) __PYX_ERR(0, 3084, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":3105
 * 
 * 
 * def print_parenthesizes(             # <<<<<<<<<<<<<<
 *     precedence, outer_precedence=None, parenthesize_when_equal=False
 * ) -> bool:
 */
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "mathics/core/expression.py":3107
 * def print_parenthesizes(
 *     precedence, outer_precedence=None, parenthesize_when_equal=False
 * ) -> bool:             # <<<<<<<<<<<<<<
 *     return outer_precedence is not None and (
 *         outer_precedence > precedence
 */
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_return, ((PyObject*)&PyBool_Type)) < 0) __PYX_ERR(0, 3105, __pyx_L1_error)

  /* "mathics/core/expression.py":3105
 * 
 * 
 * def print_parenthesizes(             # <<<<<<<<<<<<<<
 *     precedence, outer_precedence=None, parenthesize_when_equal=False
 * ) -> bool:
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_27print_parenthesizes, 0, __pyx_n_s_print_parenthesizes, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__851)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__852);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_7);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_parenthesizes, __pyx_t_1) < 0) __PYX_ERR(0, 3105, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3114
 * 
 * 
 * def _is_neutral_symbol(symbol_name, cache, evaluation):             # <<<<<<<<<<<<<<
 *     # a symbol is neutral if it does not invoke any rules, but is sure to make its Expression stay
 *     # the way it is (e.g. List[1, 2, 3] will always stay List[1, 2, 3], so long as nobody defines
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_29_is_neutral_symbol, 0, __pyx_n_s_is_neutral_symbol, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__854)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_neutral_symbol, __pyx_t_1) < 0) __PYX_ERR(0, 3114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3141
 * 
 * 
 * def _is_neutral_head(head, cache, evaluation):             # <<<<<<<<<<<<<<
 *     if not isinstance(head, Symbol):
 *         return False
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_31_is_neutral_head, 0, __pyx_n_s_is_neutral_head, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__856)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_neutral_head, __pyx_t_1) < 0) __PYX_ERR(0, 3141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3155
 * 
 * 
 * class Structure(object):             # <<<<<<<<<<<<<<
 *     def __call__(self, leaves):
 *         # create an Expression with the given list "leaves" as leaves.
 */
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__857); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__857, __pyx_n_s_Structure, __pyx_n_s_Structure, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "mathics/core/expression.py":3156
 * 
 * class Structure(object):
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         # create an Expression with the given list "leaves" as leaves.
 *         # NOTE: the caller guarantees that "leaves" only contains items that are from "origins".
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_9Structure_1__call__, 0, __pyx_n_s_Structure___call, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__859)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_call, __pyx_t_6) < 0) __PYX_ERR(0, 3156, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":3161
 *         raise NotImplementedError
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         # create an Expression with a subset of "expr".leaves (picked out by the filter "cond").
 *         # NOTE: the caller guarantees that "expr" is from "origins".
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_9Structure_3filter, 0, __pyx_n_s_Structure_filter, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__861)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_filter, __pyx_t_6) < 0) __PYX_ERR(0, 3161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":3166
 *         raise NotImplementedError
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         # create an Expression, using the given slice of "expr".leaves as leaves.
 *         # NOTE: the caller guarantees that "expr" is from "origins".
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_9Structure_5slice, 0, __pyx_n_s_Structure_slice, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__863)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_slice, __pyx_t_6) < 0) __PYX_ERR(0, 3166, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/core/expression.py":3155
 * 
 * 
 * class Structure(object):             # <<<<<<<<<<<<<<
 *     def __call__(self, leaves):
 *         # create an Expression with the given list "leaves" as leaves.
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Structure, __pyx_tuple__857, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Structure, __pyx_t_6) < 0) __PYX_ERR(0, 3155, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3176
 * 
 * 
 * class UnlinkedStructure(Structure):             # <<<<<<<<<<<<<<
 *     def __init__(self, head):
 *         self._head = head
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Structure); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_UnlinkedStructure, __pyx_n_s_UnlinkedStructure, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "mathics/core/expression.py":3177
 * 
 * class UnlinkedStructure(Structure):
 *     def __init__(self, head):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = None
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_17UnlinkedStructure_1__init__, 0, __pyx_n_s_UnlinkedStructure___init, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__865)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 3177, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":3181
 *         self._cache = None
 * 
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_17UnlinkedStructure_3__call__, 0, __pyx_n_s_UnlinkedStructure___call, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__867)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_call, __pyx_t_4) < 0) __PYX_ERR(0, 3181, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":3186
 *         return expr
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_17UnlinkedStructure_5filter, 0, __pyx_n_s_UnlinkedStructure_filter, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__869)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_filter, __pyx_t_4) < 0) __PYX_ERR(0, 3186, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":3189
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_17UnlinkedStructure_7slice, 0, __pyx_n_s_UnlinkedStructure_slice, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__871)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_slice, __pyx_t_4) < 0) __PYX_ERR(0, 3189, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":3176
 * 
 * 
 * class UnlinkedStructure(Structure):             # <<<<<<<<<<<<<<
 *     def __init__(self, head):
 *         self._head = head
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_UnlinkedStructure, __pyx_t_7, __pyx_t_6, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_UnlinkedStructure, __pyx_t_4) < 0) __PYX_ERR(0, 3176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/core/expression.py":3202
 * 
 * 
 * class LinkedStructure(Structure):             # <<<<<<<<<<<<<<
 *     def __init__(self, head, cache):
 *         self._head = head
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Structure); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_7, __pyx_t_1, __pyx_n_s_LinkedStructure, __pyx_n_s_LinkedStructure, (PyObject *) NULL, __pyx_n_s_mathics_core_expression, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "mathics/core/expression.py":3203
 * 
 * class LinkedStructure(Structure):
 *     def __init__(self, head, cache):             # <<<<<<<<<<<<<<
 *         self._head = head
 *         self._cache = cache
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_15LinkedStructure_1__init__, 0, __pyx_n_s_LinkedStructure___init, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__873)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 3203, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":3207
 *         self._cache = cache
 * 
 *     def __call__(self, leaves):             # <<<<<<<<<<<<<<
 *         expr = Expression(self._head)
 *         expr._leaves = tuple(leaves)
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_15LinkedStructure_3__call__, 0, __pyx_n_s_LinkedStructure___call, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__875)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_call, __pyx_t_4) < 0) __PYX_ERR(0, 3207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":3213
 *         return expr
 * 
 *     def filter(self, expr, cond):             # <<<<<<<<<<<<<<
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_15LinkedStructure_5filter, 0, __pyx_n_s_LinkedStructure_filter, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__877)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_filter, __pyx_t_4) < 0) __PYX_ERR(0, 3213, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":3216
 *         return self([leaf for leaf in expr._leaves if cond(leaf)])
 * 
 *     def slice(self, expr, py_slice):             # <<<<<<<<<<<<<<
 *         leaves = expr._leaves
 *         lower, upper, step = py_slice.indices(len(leaves))
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_15LinkedStructure_7slice, 0, __pyx_n_s_LinkedStructure_slice, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__879)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_slice, __pyx_t_4) < 0) __PYX_ERR(0, 3216, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/core/expression.py":3202
 * 
 * 
 * class LinkedStructure(Structure):             # <<<<<<<<<<<<<<
 *     def __init__(self, head, cache):
 *         self._head = head
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_7, __pyx_n_s_LinkedStructure, __pyx_t_1, __pyx_t_6, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LinkedStructure, __pyx_t_4) < 0) __PYX_ERR(0, 3202, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3230
 * 
 * 
 * def structure(head, origins, evaluation, structure_cache=None):             # <<<<<<<<<<<<<<
 *     # creates a Structure for building Expressions with head "head" and leaves
 *     # originating (exlusively) from "origins" (leaves are passed into the functions
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_33structure, 0, __pyx_n_s_structure, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__881)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__882);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_structure, __pyx_t_1) < 0) __PYX_ERR(0, 3230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3263
 * 
 * 
 * def atom_list_constructor(evaluation, head, *atom_names):             # <<<<<<<<<<<<<<
 *     # if we encounter an Expression that consists wholly of atoms and those atoms (and the
 *     # expression's head) have no rules associated with them, we can speed up evaluation.
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_35atom_list_constructor, 0, __pyx_n_s_atom_list_constructor, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__884)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_atom_list_constructor, __pyx_t_1) < 0) __PYX_ERR(0, 3263, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":3303
 * 
 * 
 * def string_list(head, leaves, evaluation):             # <<<<<<<<<<<<<<
 *     return atom_list_constructor(evaluation, head, "String")(leaves)
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_4core_10expression_37string_list, 0, __pyx_n_s_string_list, NULL, __pyx_n_s_mathics_core_expression, __pyx_d, ((PyObject *)__pyx_codeobj__886)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_string_list, __pyx_t_1) < 0) __PYX_ERR(0, 3303, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/core/expression.py":1
 * # cython: language_level=3             # <<<<<<<<<<<<<<
 * # -*- coding: utf-8 -*-
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init mathics.core.expression", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init mathics.core.expression");
  }
  __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;
}

/* 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 = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

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

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

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

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* SliceObject */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

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

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

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

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

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

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

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

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

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

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

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

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

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* HasAttr */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* None */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* DictGetItem */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* FetchCommonType */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunctionShared */
#include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    if (unlikely(op == NULL))
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults_size = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
#if PY_MAJOR_VERSION < 3
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
#endif
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    m->defaults_size = size;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

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

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
            if (PY_VERSION_HEX >= 0x030700A0) {
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            } else {
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            }
        } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_FALSE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_TRUE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_TRUE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_NE));
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    if (likely(cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
            return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
            #else
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
            #endif
        }
        #if PY_VERSION_HEX >= 0x030700A0
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
        #endif
    }
    return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(3);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 1, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 2, arg2);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(3, self, arg1, arg2);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* dict_getitem_default */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
    if ((1));
#else
    if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    }
#endif
    else {
        if (default_value == Py_None)
            value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
        else
            value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
    }
    return value;
}

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_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 -1;
                    PyErr_Clear();
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
#else
    if (is_list || PySequence_Check(o))
#endif
    {
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

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

/* pyfrozenset_new */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
    if (it) {
        PyObject* result;
#if CYTHON_COMPILING_IN_PYPY
        PyObject* args;
        args = PyTuple_Pack(1, it);
        if (unlikely(!args))
            return NULL;
        result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
        Py_DECREF(args);
        return result;
#else
        if (PyFrozenSet_CheckExact(it)) {
            Py_INCREF(it);
            return it;
        }
        result = PyFrozenSet_New(it);
        if (unlikely(!result))
            return NULL;
        if (likely(PySet_GET_SIZE(result)))
            return result;
        Py_DECREF(result);
#endif
    }
#if CYTHON_USE_TYPE_SLOTS
    return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#else
    return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#endif
}

/* PySetContains */
static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
    int result = -1;
    if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
        PyObject *tmpkey;
        PyErr_Clear();
        tmpkey = __Pyx_PyFrozenSet_New(key);
        if (tmpkey != NULL) {
            result = PySet_Contains(set, tmpkey);
            Py_DECREF(tmpkey);
        }
    }
    return result;
}
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
    int result = PySet_Contains(set, key);
    if (unlikely(result < 0)) {
        result = __Pyx_PySet_ContainsUnhashable(set, key);
    }
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* None */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

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

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* CIntToDigits */
static const char DIGIT_PAIRS_10[2*10*10+1] = {
    "00010203040506070809"
    "10111213141516171819"
    "20212223242526272829"
    "30313233343536373839"
    "40414243444546474849"
    "50515253545556575859"
    "60616263646566676869"
    "70717273747576777879"
    "80818283848586878889"
    "90919293949596979899"
};
static const char DIGIT_PAIRS_8[2*8*8+1] = {
    "0001020304050607"
    "1011121314151617"
    "2021222324252627"
    "3031323334353637"
    "4041424344454647"
    "5051525354555657"
    "6061626364656667"
    "7071727374757677"
};
static const char DIGITS_HEX[2*16+1] = {
    "0123456789abcdef"
    "0123456789ABCDEF"
};

/* BuildPyUnicode */
static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
                                                int prepend_sign, char padding_char) {
    PyObject *uval;
    Py_ssize_t uoffset = ulength - clength;
#if CYTHON_USE_UNICODE_INTERNALS
    Py_ssize_t i;
#if CYTHON_PEP393_ENABLED
    void *udata;
    uval = PyUnicode_New(ulength, 127);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_DATA(uval);
#else
    Py_UNICODE *udata;
    uval = PyUnicode_FromUnicode(NULL, ulength);
    if (unlikely(!uval)) return NULL;
    udata = PyUnicode_AS_UNICODE(uval);
#endif
    if (uoffset > 0) {
        i = 0;
        if (prepend_sign) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-');
            i++;
        }
        for (; i < uoffset; i++) {
            __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char);
        }
    }
    for (i=0; i < clength; i++) {
        __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]);
    }
#else
    {
        PyObject *sign = NULL, *padding = NULL;
        uval = NULL;
        if (uoffset > 0) {
            prepend_sign = !!prepend_sign;
            if (uoffset > prepend_sign) {
                padding = PyUnicode_FromOrdinal(padding_char);
                if (likely(padding) && uoffset > prepend_sign + 1) {
                    PyObject *tmp;
                    PyObject *repeat = PyInt_FromSize_t(uoffset - prepend_sign);
                    if (unlikely(!repeat)) goto done_or_error;
                    tmp = PyNumber_Multiply(padding, repeat);
                    Py_DECREF(repeat);
                    Py_DECREF(padding);
                    padding = tmp;
                }
                if (unlikely(!padding)) goto done_or_error;
            }
            if (prepend_sign) {
                sign = PyUnicode_FromOrdinal('-');
                if (unlikely(!sign)) goto done_or_error;
            }
        }
        uval = PyUnicode_DecodeASCII(chars, clength, NULL);
        if (likely(uval) && padding) {
            PyObject *tmp = PyNumber_Add(padding, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
        if (likely(uval) && sign) {
            PyObject *tmp = PyNumber_Add(sign, uval);
            Py_DECREF(uval);
            uval = tmp;
        }
done_or_error:
        Py_XDECREF(padding);
        Py_XDECREF(sign);
    }
#endif
    return uval;
}

/* CIntToPyUnicode */
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned short    uint16_t;
        #else
           typedef unsigned __int16  uint16_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char) {
    char digits[sizeof(Py_ssize_t)*3+2];
    char *dpos, *end = digits + sizeof(Py_ssize_t)*3+2;
    const char *hex_digits = DIGITS_HEX;
    Py_ssize_t length, ulength;
    int prepend_sign, last_one_off;
    Py_ssize_t remaining;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const Py_ssize_t neg_one = (Py_ssize_t) -1, const_zero = (Py_ssize_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (format_char == 'X') {
        hex_digits += 16;
        format_char = 'x';
    }
    remaining = value;
    last_one_off = 0;
    dpos = end;
    do {
        int digit_pos;
        switch (format_char) {
        case 'o':
            digit_pos = abs((int)(remaining % (8*8)));
            remaining = (Py_ssize_t) (remaining / (8*8));
            dpos -= 2;
            *(uint16_t*)dpos = ((const uint16_t*)DIGIT_PAIRS_8)[digit_pos];
            last_one_off = (digit_pos < 8);
            break;
        case 'd':
            digit_pos = abs((int)(remaining % (10*10)));
            remaining = (Py_ssize_t) (remaining / (10*10));
            dpos -= 2;
            *(uint16_t*)dpos = ((const uint16_t*)DIGIT_PAIRS_10)[digit_pos];
            last_one_off = (digit_pos < 10);
            break;
        case 'x':
            *(--dpos) = hex_digits[abs((int)(remaining % 16))];
            remaining = (Py_ssize_t) (remaining / 16);
            break;
        default:
            assert(0);
            break;
        }
    } while (unlikely(remaining != 0));
    if (last_one_off) {
        assert(*dpos == '0');
        dpos++;
    }
    length = end - dpos;
    ulength = length;
    prepend_sign = 0;
    if (!is_unsigned && value <= neg_one) {
        if (padding_char == ' ' || width <= length + 1) {
            *(--dpos) = '-';
            ++length;
        } else {
            prepend_sign = 1;
        }
        ++ulength;
    }
    if (width > ulength) {
        ulength = width;
    }
    if (ulength == 1) {
        return PyUnicode_FromOrdinal(*dpos);
    }
    return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char);
}

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_EqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a;
    (void)inplace;
    (void)zerodivision_check;
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            return (
                PyFloat_Type.tp_richcompare(op2, op1, Py_EQ));
        }
    } else {
        return (
            PyObject_RichCompare(op1, op2, Py_EQ));
    }
        if (a == b) {
            Py_RETURN_TRUE;
        } else {
            Py_RETURN_FALSE;
        }
}
#endif

/* py_abs */
  #if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
    if (likely(Py_SIZE(n) == -1)) {
        return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    {
        PyObject *copy = _PyLong_Copy((PyLongObject*)n);
        if (likely(copy)) {
            __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
        }
        return copy;
    }
#else
    return PyNumber_Negative(n);
#endif
}
#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;
}

/* SliceTupleAndList */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyList_New(0);
    dest = PyList_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyListObject*)src)->ob_item + start,
        ((PyListObject*)dest)->ob_item,
        length);
    return dest;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyTuple_New(0);
    dest = PyTuple_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyTupleObject*)src)->ob_item + start,
        ((PyTupleObject*)dest)->ob_item,
        length);
    return dest;
}
#endif

/* PyObject_GenericGetAttrNoDict */
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    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

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

/* CyFunctionClassCell */
  static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj) {
    Py_ssize_t i, count = PyList_GET_SIZE(cyfunctions);
    for (i = 0; i < count; i++) {
        __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *)
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            PyList_GET_ITEM(cyfunctions, i);
#else
            PySequence_ITEM(cyfunctions, i);
        if (unlikely(!m))
            return -1;
#endif
        Py_INCREF(classobj);
        m->func_classobj = classobj;
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
        Py_DECREF((PyObject*)m);
#endif
    }
    return 0;
}

/* CLineInTraceback */
  #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
  #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntToPy */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
#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);
    }
}

/* CIntFromPyVerify */
  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntFromPy */
  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
#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 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

/* 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_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 (self->ob_refcnt > 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(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        __Pyx_SET_REFCNT(self, refcnt);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_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 __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;
    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},
    {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;
}

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