code: def stop(self):
          
          if self._done_event.is_set():
              # Stop event set: we're stopped
              return
  
          # Set the stop event
          self._done_event.set()
  
          with self.__lock:
              # Add something in the queue (to unlock the join())
              try:
                  for _ in self._threads:
                      self._queue.put(self._done_event, True, self._timeout)
              except queue.Full:
                  # There is already something in the queue
                  pass
  
              # Copy the list of threads to wait for
              threads = self._threads[:]
  
          # Join threads outside the lock
          for thread in threads:
              while thread.is_alive():
                  # Wait 3 seconds
                  thread.join(3)
                  if thread.is_alive():
                      # Thread is still alive: something might be wrong
                      self._logger.warning(
                          "Thread %s is still alive...", thread.name
                      )
  
          # Clear storage
          del self._threads[:]
          self.clear()
docs: Stops the thread pool. Does nothing if the pool is already stopped.