'Add a function as a listener for the specified event.'

def register_listener(self, event, func):

    wrapped_func = self._set_log_level_and_params(logging.WARNING, func)
    cls = self.__class__
    if ((cls.listeners is None) or (cls._raw_listeners is None)):
        cls._raw_listeners = defaultdict(list)
        cls.listeners = defaultdict(list)
    if (func not in cls._raw_listeners[event]):
        cls._raw_listeners[event].append(func)
        cls.listeners[event].append(wrapped_func)
