def get_title(mode='<STR_LIT:title>'):
title = None<EOL>if is_a_tty() and not env.SSH_CLIENT:<EOL><INDENT>if os_name == '<STR_LIT>':<EOL><INDENT>from .windows import get_title<EOL>return get_title()<EOL><DEDENT>elif sys.platform == '<STR_LIT>':<EOL><INDENT>if env.TERM_PROGRAM and env.TERM_PROGRAM == '<STR_LIT>':<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>return<EOL><DEDENT><DEDENT>elif os_name == '<STR_LIT>':<EOL><INDENT>pass<EOL><DEDENT>import tty, termios<EOL>mode = _query_mode_map.get(mode, mode)<EOL>query_sequence = f'<STR_LIT>'<EOL>try:<EOL><INDENT>with TermStack() as fd:<EOL><INDENT>termios.tcflush(fd, termios.TCIFLUSH)   <EOL>tty.setcbreak(fd, termios.TCSANOW)      <EOL>sys.stdout.write(query_sequence)<EOL>sys.stdout.flush()<EOL>resp = _read_until(maxchars=<NUM_LIT:100>, end=ST)<EOL><DEDENT><DEDENT>except AttributeError:  <EOL><INDENT>return title<EOL><DEDENT>title = resp.lstrip(OSC)[<NUM_LIT:1>:].rstrip(ESC)<EOL><DEDENT>log.debug('<STR_LIT>', title)<EOL>return title<EOL>
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 "".