code: def _get_getch_impl_unix() -> Optional[Callable[[], str]]:
      try:
          import sys  # type: ignore
          import tty  # type: ignore
          import termios  # type: ignore
      except ImportError:
          return None
  
      def _getch():
          fd = sys.stdin.fileno()
          old_settings = termios.tcgetattr(fd)
          ch = None
          try:
              tty.setraw(fd)
              ch = sys.stdin.read(1)
          finally:
              termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
              if ch is not None and ord(ch) == 3:
                  raise KeyboardInterrupt
              return ch
  
      return _getch
  
file_path: vowpal_wabbit/utl/active_interactor.py
imports: import socket
  import argparse
  from typing import Callable, ContextManager, Optional, TextIO
  import contextlib
label_desc: Use image node_id 2 for calling a global function with example usage: _get_getch_impl_unix() and returns: _getch, None, ch