code: def shutdown(self, restart=True):
          
          self._check_if_ready()
          self.collection.stop()
          self.collection.wait()
          self.main_loop.join()
          self.main_loop = None
          self.collection.clear()
          if restart:
              self.collection.start()
              self._init()
docs: Stop the execution of enqueued jobs, and wait for all running
          jobs to complete. This method is synchronous and returns as soon
          as all jobs are terminated (i.e. all threads are stopped).
  
          If restart is True, the workqueue is restarted and paused,
          so you may fill it with new jobs.
  
          If restart is False, the WorkQueue can no longer be used after calling
          this method.
  
          :type  restart: bool
          :param restart: Whether to restart the queue after shutting down.