Unregister some listener; ignore if the listener was never
        registered.

        :type listener: :class:`SessionListener`

def remove_listener(self, listener):
        """Unregister some listener; ignore if the listener was never
        registered.

        :type listener: :class:`SessionListener`
        """
        self.logger.debug('discarding listener %r', listener)
        with self._lock:
            self._listeners.discard(listener)