def check_is_number(expression):
  """Checks whether expression is a number.

  Args:
    expression: Sympy expression.

  Returns:
    Boolean.
  """
  # NOTE(leeley): If sympy expression is a single numerical value, it may be
  # represented as float or int instead of sympy expression.
  # For example,
  # sympy.sympify('1.') is sympy.core.numbers.Float
  # sympy.sympify('c', locals={'c': 1.}) is float.
  return isinstance(expression, (int, float)) or expression.is_number