def _eval_expr(expr, vals, x):
    """
    This function tries calling expr.eval. Calls expr.cpp_object().eval
    if the first fails. This is for FEniCS 2018.1.0 compatibility.
    """
    try:
        expr.eval(vals, x)
    except AttributeError:
        expr.cpp_object().eval(vals, x)
    return None