'Emit an event with optional keyword arguments.
:type event_name: string
:param event_name: Name of the event
:type kwargs: dict
:param kwargs: Arguments to be passed to the handler functions.
:type stop_on_response: boolean
:param stop_on_response: Whether to stop on the first non-None
response. If False, then all handlers
will be called. This is especially useful
to handlers which mutate data and then
want to stop propagation of the event.
:rtype: list
:return: List of (handler, response) tuples from all processed
handlers.'

def _emit(self, event_name, kwargs, stop_on_response=False):

    responses = []
    handlers_to_call = self._lookup_cache.get(event_name)
    if (handlers_to_call is None):
        handlers_to_call = self._handlers.prefix_search(event_name)
        self._lookup_cache[event_name] = handlers_to_call
    elif (not handlers_to_call):
        return []
    kwargs['event_name'] = event_name
    responses = []
    for handler in handlers_to_call:
        logger.debug('Event    %s:    calling    handler    %s', event_name, handler)
        response = handler(**kwargs)
        responses.append((handler, response))
        if (stop_on_response and (response is not None)):
            return responses
    return responses
