'Initialize PyYAML event listener.
Constructs internal mapping directly from event type to method on actual
handler.  This prevents reflection being used during actual parse time.
Args:
event_handler: Event handler that will receive mapped events. Must
implement at least one appropriate handler method named from
the values of the _EVENT_METHOD_MAP.
Raises:
ListenerConfigurationError if event_handler is not an EventHandler.'

def __init__(self, event_handler):

    if (not isinstance(event_handler, EventHandler)):
        raise yaml_errors.ListenerConfigurationError('Must    provide    event    handler    of    type    yaml_listener.EventHandler')
    self._event_method_map = {}
    for (event, method) in _EVENT_METHOD_MAP.iteritems():
        self._event_method_map[event] = getattr(event_handler, method)
