def register_observer(self, observer, events=None):
        """Register a listener function.

        :param observer: external listener function
        :param events: tuple or list of relevant events (default=None)
        """
        if events is not None and not isinstance(events, (tuple, list)):
            events = (events,)

        if observer in self._observers:
            LOG.warning("Observer '%r' already registered, overwriting for events"
                        " %r", observer, events)
        self._observers[observer] = events