code: def handle_keypress(screen):
      
      global selected_pid
      try:
          key = screen.getkey().upper()
      except:
          return
      if key in ("KEY_DOWN", "J"):
          move_selection()
      elif key in ("KEY_UP", "K"):
          move_selection(reverse=True)
      elif key in ("A", "+"):
          send_signal("TTIN")
          if selected_pid in gunicorns:
              gunicorns[selected_pid]["workers"] = 0
      elif key in ("W", "-"):
          if selected_pid in gunicorns:
              if gunicorns[selected_pid]["workers"] != 1:
                  send_signal("TTOU")
                  gunicorns[selected_pid]["workers"] = 0
      elif key in ("R",):
          if selected_pid in gunicorns:
              send_signal("HUP")
              del gunicorns[selected_pid]
              selected_pid = None
      elif key in ("T",):
          for pid in gunicorns.copy().iterkeys():
              selected_pid = pid
              send_signal("HUP")
              del gunicorns[selected_pid]
              selected_pid = None
      elif key in ("M", "-"):
          if selected_pid in gunicorns:
              send_signal("QUIT")
              del gunicorns[selected_pid]
              selected_pid = None
      elif key in ("Q",):
          raise KeyboardInterrupt
docs: Check for a key being pressed and handle it if applicable.