def _GetCh(self):
    """Read a single character from the user.

    Returns:
      A string, the character read.
    """
    fd = self._tty.fileno()
    old = termios.tcgetattr(fd)
    try:
      tty.setraw(fd)
      ch = self._tty.read(1)
      # Also support arrow key shortcuts (escape + 2 chars)
      if ord(ch) == 27:
        ch += self._tty.read(2)
    finally:
      termios.tcsetattr(fd, termios.TCSADRAIN, old)
    return ch
Read a single character from the user.

    Returns:
      A string, the character read.