code: def _wait_till_process_killed(pid, timeout):
      keyboard_interrupted = False
      time_count = 0
      # Usually, a process is killed very quickly.
      # This little nap will save 1 second.
      time.sleep(0.01)
      while True:
          try:
              # Implementation of waiting
              while time_count < timeout:
                  pid_running = _check_pid_running(pid)
                  if not pid_running:
                      return True
                  time.sleep(1)
                  time_count += 1
              return False
          except KeyboardInterrupt:
              # Warn at the first keyboard interrupt and do nothing
              # Stop at the second
              if keyboard_interrupted:
                  print_warning("Wait of process killing cancelled.")
                  # I think throwing an exception is more reasonable.
                  # Another option is to return false here, which is also acceptable.
                  raise
              print_warning(
                  f"Waiting for the cleanup of a process (pid = {pid}). "
                  "We suggest you waiting for it to complete. "
                  "Press Ctrl-C again if you intend to interrupt the cleanup."
              )
              keyboard_interrupted = True
  
      # Actually we will never reach here
      return False
  
file_path: nni/nni/tools/nnictl/command_utils.py
imports: from subprocess import call, check_output
  import sys
  import os
  import time
  import signal
  import psutil
  from .common_utils import print_error, print_warning
label_desc: Use image node_id 5 for calling a global function with example usage: _wait_till_process_killed(pid, timeout) and returns: False, False, True