code: def fast_float(
      x,
      key=lambda x: x,
      nan=None,
      _uni=unicodedata.numeric,
      _nan_inf=NAN_INF,
      _first_char=POTENTIAL_FIRST_CHAR,
  ):
      if x[0] in _first_char or x.lstrip()[:3] in _nan_inf:
          try:
              x = float(x)
              return nan if nan is not None and x != x else x
          except ValueError:
              try:
                  return _uni(x, key(x)) if len(x) == 1 else key(x)
              except TypeError:
                  return key(x)
      else:
          try:
              return _uni(x, key(x)) if len(x) == 1 else key(x)
          except TypeError:
              return key(x)