code: def stop(self):
          
          if self.running and self.num_workers:
              for worker in self.workers:
                  self.queue.put(None)
              for worker in self.workers:
                  worker.join()
              # Free up references held by workers
              del self.workers[:]
              self.queue.join()
          self.running = False
docs: Stop the workers (will block until they are finished).