code: def on_connection_state_change(self, event_type, callback):
          
          listeners = self._connection_state_listeners.get(event_type, [])
          listeners.append(callback)
          self._connection_state_listeners[event_type] = listeners
docs: Register a callback for a specific connection state change.
  
          Register a callback to be triggered when the connection changes to
          the specified state, signified by a ConnectionEvent.
  
          The callback must be a coroutine.
  
          Args:
              event_type (ConnectionEvent): the connection event to listen for
              callback (coroutine): a coroutine to call on the event occurrence