import sympy


def _validate_expression(expression):
    """Check to see that an expression is a valid sympy expression"""
    if expression is None or isinstance(expression, sympy.Expr):
        pass
    elif isinstance(expression, str):
        expression = sympy.sympify(expression)
    else:
        raise ValueError("Please enter a string, sympy expression, "
                         "or None for expression")

    return expression