def try_number(value):
for cast_function in [int, float]:<EOL><INDENT>try:<EOL><INDENT>return cast_function(value)<EOL><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>raise ValueError("<STR_LIT>"<EOL>.format(value))<EOL>
Attempt to cast the string `value` to an int, and failing that, a float,
failing that, raise a ValueError.