code: def _kill_process(self, pid, sig=signal.SIGKILL):
          
          try:
              os.kill(pid, sig)
          except OSError as e:
              if e.errno == errno.ESRCH: # process itself returned and exited before killing
                  logging.debug("Failure %s while killing process %s with signal %s: %s",
                                e.errno, pid, sig, e.strerror)
              else:
                  logging.warning("Failure %s while killing process %s with signal %s: %s",
                                  e.errno, pid, sig, e.strerror)
docs: Try to send signal to given process.