code: def _visible_width(s):
      
      # optional wide-character support
      if wcwidth is not None and WIDE_CHARS_MODE:
          len_fn = wcwidth.wcswidth
      else:
          len_fn = len
      if isinstance(s, _text_type) or isinstance(s, _binary_type):
          return len_fn(_strip_invisible(s))
      else:
          return len_fn(_text_type(s))
docs: Visible width of a printed string. ANSI color codes are removed.
  
      >>> _visible_width('\x1b[31mhello\x1b[0m'), _visible_width("world")
      (5, 5)