code: def char_width(char):
      
      if ord(char) < 128:
          return 1
      elif unicodedata.east_asian_width(char) in ('F', 'W'):
          return 2
      elif unicodedata.category(char) in ('Mn',):
          return 0
      else:
          return 1
docs: Get the display length of a unicode character.