def format_val(val):
val = text_type(val)<EOL>if val.isdigit():<EOL><INDENT>return int(val)<EOL><DEDENT>else:<EOL><INDENT>return '<STR_LIT>'.format(val)<EOL><DEDENT>
Returns val as integer or as escaped string according to its value
:param val: any value
:return: formatted string