code: def get_listener_instance(self, cls):
          
          with self._lock:
              for listener in self._listeners:
                  if isinstance(listener, cls):
                      return listener
docs: If a listener of the specified type is registered, returns the
          instance.
  
          :type cls: :class:`SessionListener`