code: async def stop(self):
          
  
          if self._rpc_task is not None:
              self._rpc_task.cancel()
  
          try:
              await self._rpc_task
          except asyncio.CancelledError:
              pass
  
          self._rpc_task = None
docs: Stop the rpc queue from inside the event loop.