code: def kill(self):
      
      self._killed.set()
      if not self.is_alive():
        logging.debug('Cannot kill thread that is no longer running.')
        return
      if not self._is_thread_proc_running():
        logging.debug("Thread's _thread_proc function is no longer running, "
                      'will not kill; letting thread exit gracefully.')
        return
      self.async_raise(ThreadTerminationError)
docs: Terminates the current thread by raising an error.