def _sympy_to_scalar(e):
    """Convert from a sympy scalar to a Python scalar."""
    if isinstance(e, Expr):
        if e.is_Integer:
            return int(e)
        elif e.is_Float:
            return float(e)
        elif e.is_Rational:
            return float(e)
        elif e.is_Number or e.is_NumberSymbol or e == I:
            return complex(e)
    raise TypeError(e % 'Expected number, got: %r')
dataset/ETHPy150Open sympy/sympy/sympy/physics/quantum/represent.py/_sympy_to_scalar/swapped operands of `%`