code: def __stop(self):  # pragma: no cover
          
  
          if not self.dispatcher_thread:
              return
  
          logger.info('Stopping dispatcher')
          self.running = False  # graceful shutdown
          self.dispatcher_thread.join()
          self.dispatcher_thread = None
docs: Stops the background engine.