def expr(s):
if isinstance(s, Expr): return s<EOL>if isnumber(s): return Expr(s)<EOL>s = s.replace('<STR_LIT>', '<STR_LIT>').replace('<STR_LIT>', '<STR_LIT>')<EOL>s = s.replace('<STR_LIT>', '<STR_LIT:%>').replace('<STR_LIT>', '<STR_LIT>')<EOL>s = re.sub(r'<STR_LIT>', r'<STR_LIT>', s)<EOL>return eval(s, {'<STR_LIT>':Expr})<EOL>
Create an Expr representing a logic expression by parsing the input
    string. Symbols and numbers are automatically converted to Exprs.
    In addition you can use alternative spellings of these operators:
      'x ==> y'   parses as   (x >> y)    # Implication
      'x <== y'   parses as   (x << y)    # Reverse implication
      'x <=> y'   parses as   (x % y)     # Logical equivalence
      'x =/= y'   parses as   (x ^ y)     # Logical disequality (xor)
    But BE CAREFUL; precedence of implication is wrong. expr('P & Q ==> R & S')
    is ((P & (Q >> R)) & S); so you must use expr('(P & Q) ==> (R & S)').
    >>> expr('P <=> Q(1)')
    (P <=> Q(1))
    >>> expr('P & Q | ~R(x, F(x))')
    ((P & Q) | ~R(x, F(x)))