code: def run(self):
      
      if platform.system() == 'Windows':
        # Windows doesn't support file-like objects for select(), so fall back
        # to raw_input().
        response = input(''.join((self._message,
                                  os.linesep,
                                  PROMPT)))
        self._answered = True
        self._callback(response)
        return
  
      # First, display the prompt to the console.
      console_output.cli_print(self._message, color=self._color,
                               end=os.linesep, logger=None)
      console_output.cli_print(PROMPT, color=self._color, end='', logger=None)
      sys.stdout.flush()
  
      # Before reading, clear any lingering buffered terminal input.
      termios.tcflush(sys.stdin, termios.TCIFLUSH)
  
      line = ''
      while not self._stop_event.is_set():
        inputs, _, _ = select.select([sys.stdin], [], [], 0.001)
        if sys.stdin in inputs:
          new = os.read(sys.stdin.fileno(), 1024)
          if not new:
            # Hit EOF!
            # They hit ^D (to insert EOF). Tell them to hit ^C if they
            # want to actually quit.
            print('Hit ^C (Ctrl+c) to exit.')
            break
          line += new.decode('utf-8')
          if '\n' in line:
            response = line[:line.find('\n')]
            self._answered = True
            self._callback(response)
            return
docs: Main logic for this thread to execute.