code: def stop(self):
          
          if not self.running:
              return
  
          self.logger.debug("stopping main task of %r", self, stack_info=True)
          self._main_task.cancel()
docs: Stop the client. This sends a signal to the clients main task which
          makes it terminate.
  
          It may take some cycles through the event loop to stop the client
          task. To check whether the task has actually stopped, query
          :attr:`running`.