code: def fast_int(
      x,
      key=lambda x: x,
      _uni=unicodedata.digit,
      _first_char=POTENTIAL_FIRST_CHAR,
  ):
      if x[0] in _first_char:
          try:
              return long(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)