Small helper to find all handlers associated to a given event

    If the event can't be found, an empty list will be returned, since
    this is an internal function and all validation against the event
    name and its existence was already performed.

def find_handlers(event_name, registry=HANDLER_REGISTRY):
    """Small helper to find all handlers associated to a given event

    If the event can't be found, an empty list will be returned, since
    this is an internal function and all validation against the event
    name and its existence was already performed.
    """
    handlers = []

    # event_name can be a BaseEvent or the string representation
    if isinstance(event_name, basestring):
        matched_events = [event for event in registry.keys()
            if fnmatch.fnmatchcase(event_name, event)]
        for matched_event in matched_events:
            handlers.extend(registry.get(matched_event))
    else:
        handlers = registry.get(find_event(event_name), [])

    return handlers