docs: def get_title(mode='title'):
      ''' Return the terminal/console title.
  
          Arguments:
              str:  mode,  one of ('title', 'icon') or int (20-21):
                    see links below.
  
          - `Control sequences
            <http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands>`_
  
          Returns:
              title string, or None if not able to be found.
  
          Note:
              Experimental, few terms outside xterm support this correctly.
              MATE Terminal returns "Terminal".
              iTerm returns "".
      '''
      title = None
      if is_a_tty() and not env.SSH_CLIENT:
          if os_name == 'nt':
              from .windows import get_title
              return get_title()
  
          elif sys.platform == 'darwin':
              if env.TERM_PROGRAM and env.TERM_PROGRAM == 'iTerm.app':
                  pass
              else:
                  return
          elif os_name == 'posix':
              pass
  
          # xterm (maybe iterm) only support
          import tty, termios
          mode = _query_mode_map.get(mode, mode)
          query_sequence = f'{CSI}{mode}t'
          try:
              with TermStack() as fd:
                  termios.tcflush(fd, termios.TCIFLUSH)   # clear input
  
                  tty.setcbreak(fd, termios.TCSANOW)      # shut off echo
                  sys.stdout.write(query_sequence)
                  sys.stdout.flush()
                  resp = _read_until(maxchars=100, end=ST)
          except AttributeError:  # no .fileno()
              return title
  
          # parse response
          title = resp.lstrip(OSC)[1:].rstrip(ESC)
  
      log.debug('%r', title)
      return title