code: def disconnect(self):
          
          self._state_mutex.acquire()
          self._state = mqtt_cs_disconnecting
          self._state_mutex.release()
  
          self._backoffCore.stopStableConnectionTimer()
  
          if self._sock is None and self._ssl is None:
              return MQTT_ERR_NO_CONN
  
          return self._send_disconnect()
docs: Disconnect a connected client from the broker.