def evaluateFalse(s):
 node = ast.parse(s)
 node = EvaluateFalseTransformer().visit(node)
 node = ast.Expression(node.body[0].value)
 return ast.fix_missing_locations(node)

def evaluateFalse ( s ) : node = ast . parse ( s ) node = EvaluateFalseTransformer ( ) . visit ( node ) node = ast . Expression ( node . body [ 0 ] . value ) return ast . fix_missing_locations ( node )
replaces operators with the sympy equivalent and sets evaluate=false .