'Deduces type from an expression or a ``Symbol``.
Parameters
expr : number or SymPy object
The type will be deduced from type or properties.
Examples
>>> from sympy.codegen.ast import Type, integer, complex_
>>> Type.from_expr(2) == integer
True
>>> from sympy import Symbol
>>> Type.from_expr(Symbol(\'z\', complex=True)) == complex_
True
>>> Type.from_expr(sum)  # doctest: +ELLIPSIS
Traceback (most recent call last):
ValueError: Could not deduce type from expr.
Raises
ValueError when type deduction fails.'

@classmethod
def from_expr(cls, expr):

    if isinstance(expr, (float, Float)):
        return real
    if (isinstance(expr, (int, Integer)) or getattr(expr, 'is_integer', False)):
        return integer
    if getattr(expr, 'is_real', False):
        return real
    if (isinstance(expr, complex) or getattr(expr, 'is_complex', False)):
        return complex_
    if (isinstance(expr, bool) or getattr(expr, 'is_Relational', False)):
        return bool_
    else:
        raise ValueError('Could    not    deduce    type    from    expr.')
