'Compiles a purported Python expression to ast, verifies that it\'s safe
(according to safe_eval\'s semantics) and alter its variable references to
access values data instead'

def _compile_expr(self, expr):

    st = ast.parse(expr.strip(), mode='eval')
    assert_valid_codeobj(_SAFE_OPCODES, compile(st, '<>', 'eval'), expr)
    return Contextifier(_BUILTINS).visit(st).body
