human
Solve the following python programming problem given the following code:
@asyncio.coroutine
def async_trigger(hass, config, action):
assistant
#Here is the Python program you requested.

    """Listen for events based on configuration.
    """
    event_type = config.get(CONF_EVENT_TYPE)
    event_data = config.get(CONF_EVENT_DATA)
    @callback
    def handle_event(event):
        'Listen    for    events    and    calls    the    action    when    data    matches.'
        if ((not event_data) or all(((val == event.data.get(key)) for (key, val) in event_data.items()))):
            hass.async_run_job(action, {'trigger': {'platform': 'event', 'event': event}})
    return hass.bus.async_listen(event_type, handle_event)