def _convert_to_float_if_possible(s):
 try:
  ret = float(s)
 except (ValueError, TypeError):
  ret = s
 return ret

def _convert_to_float_if_possible ( s ) : try : ret = float ( s ) except ( ValueError , TypeError ) : ret = s return ret
a small helper function to convert a string to a numeric value if appropriate .