code: def stop(self):
          
          if not self.is_alive:
              return True
  
          with self._lock:
              self._queue.put_nowait(_WORKER_TERMINATOR)
              self._thread.join(timeout=self._grace_period)
  
              success = not self.is_alive
              self._thread = None
  
              return success
docs: Signals the background thread to stop.
  
          This does not terminate the background thread. It simply queues the
          stop signal. If the main process exits before the background thread
          processes the stop signal, it will be terminated without finishing
          work. The ``grace_period`` parameter will give the background
          thread some time to finish processing before this function returns.
  
          :rtype: bool
          :returns: True if the thread terminated. False if the thread is still
                    running.