def METHOD_NAME(string):
    try:
        root = ast.parse(string, mode='eval')
        return compile(root, "<expression>", 'eval')
    except SyntaxError as e:
        logging.exception(e)
        raise Exception("Invalid expression syntax: " + str(e))