code: def _string_width(string, *, _IS_ASCII=_IS_ASCII):
      
      match = _IS_ASCII.match(string)
      if match:
          return match.endpos
  
      UNICODE_WIDE_CHAR_TYPE = 'WFA'
      width = 0
      func = unicodedata.east_asian_width
      for char in string:
          width += 2 if func(char) in UNICODE_WIDE_CHAR_TYPE else 1
      return width
docs: Returns string's width.