def parse_expr(e):
m = relation_re.match(e)<EOL>if m is None:<EOL><INDENT>raise ValueError("<STR_LIT>".format(e))<EOL><DEDENT>field, op, val = m.groups()<EOL>try:<EOL><INDENT>val_int = int(val)<EOL>val = val_int<EOL><DEDENT>except ValueError:<EOL><INDENT>try:<EOL><INDENT>val_float = float(val)<EOL>val = val_float<EOL><DEDENT>except ValueError:<EOL><INDENT>try:<EOL><INDENT>val = {'<STR_LIT:true>': True, '<STR_LIT:false>': False}[val.lower()]<EOL><DEDENT>except KeyError:<EOL><INDENT>if re.match(r'<STR_LIT>', val):<EOL><INDENT>val = val[<NUM_LIT:1>:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return field, op, val<EOL>
Parse a single constraint expression.

    Legal expressions are defined by the regular expression `relation_re`.

    :param e: Expression
    :type e: str
    :return: Tuple of field, operator, and value
    :rtype: tuple