code: def disconnect(self):
          
  
          if self.session.transitions.is_connected():
              if not self._disconnect_task.done():
                  self._disconnect_task.cancel()
              yield from self._handler.mqtt_disconnect()
              self._connected_state.clear()
              yield from self._handler.stop()
              self.session.transitions.disconnect()
          else:
              self.logger.warning("Client session is not currently connected, ignoring call")
docs: Disconnect from the connected broker.
  
              This method sends a `DISCONNECT <http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718090>`_ message and closes the network socket.
  
              This method is a *coroutine*.