def cast_to_number_or_bool(inputstr):
if inputstr.strip().lower() == "<STR_LIT:true>":<EOL><INDENT>return True<EOL><DEDENT>elif inputstr.strip().lower() == "<STR_LIT:false>":<EOL><INDENT>return False<EOL><DEDENT>try:<EOL><INDENT>return int(inputstr)<EOL><DEDENT>except ValueError:<EOL><INDENT>try:<EOL><INDENT>return float(inputstr)<EOL><DEDENT>except ValueError:<EOL><INDENT>return inputstr<EOL><DEDENT><DEDENT>
Cast a string to int, float or bool. Return original string if it can't be
    converted.

    Scientific expression is converted into float.