def _string_width(string: str, *, _IS_ASCII=_IS_ASCII) -> int:
    "Returns string's width."
    match = _IS_ASCII.match(string)
    if match:
        return match.endpos
    UNICODE_WIDE_CHAR_TYPE = 'WFA'
    func = unicodedata.east_asian_width
    return sum(((2 if (func(char) in UNICODE_WIDE_CHAR_TYPE) else 1) for char in string))
Returns string's width.
def _string_width(string: str, *, _IS_ASCII=_IS_ASCII) -> int:
    
    match = _IS_ASCII.match(string)
    if match:
        return match.endpos
    UNICODE_WIDE_CHAR_TYPE = 'WFA'
    func = unicodedata.east_asian_width
    return sum(((2 if (func(char) in UNICODE_WIDE_CHAR_TYPE) else 1) for char in string))