def resolve(val):
name = val.getName()<EOL>if name == "<STR_LIT>":<EOL><INDENT>try:<EOL><INDENT>return int(val.number)<EOL><DEDENT>except ValueError:<EOL><INDENT>return Decimal(val.number)<EOL><DEDENT><DEDENT>elif name == "<STR_LIT:str>":<EOL><INDENT>return unwrap(val.str)<EOL><DEDENT>elif name == "<STR_LIT:null>":<EOL><INDENT>return None<EOL><DEDENT>elif name == "<STR_LIT>":<EOL><INDENT>return Binary(val.binary[<NUM_LIT:2>:-<NUM_LIT:1>])<EOL><DEDENT>elif name == "<STR_LIT>":<EOL><INDENT>if val.set == "<STR_LIT>":<EOL><INDENT>return set()<EOL><DEDENT>return set([resolve(v) for v in val.set])<EOL><DEDENT>elif name == "<STR_LIT:bool>":<EOL><INDENT>return val.bool == "<STR_LIT>"<EOL><DEDENT>elif name == "<STR_LIT:list>":<EOL><INDENT>return [resolve(v) for v in val.list]<EOL><DEDENT>elif name == "<STR_LIT>":<EOL><INDENT>dict_val = {}<EOL>for k, v in val.dict:<EOL><INDENT>dict_val[resolve(k)] = resolve(v)<EOL><DEDENT>return dict_val<EOL><DEDENT>elif name == "<STR_LIT>":<EOL><INDENT>return dt_to_ts(eval_function(val.ts_function))<EOL><DEDENT>elif name == "<STR_LIT>":<EOL><INDENT>return dt_to_ts(eval_expression(val))<EOL><DEDENT>else:<EOL><INDENT>raise SyntaxError("<STR_LIT>" % val)<EOL><DEDENT>
Convert a pyparsing value to the python type