human
Complete the below
@asyncio.coroutine
def async_trigger(hass, config, action):

    ''''Listen for events based on configuration.'
    '''
assistant
#Here is the Python code you requested.
    event = config.get(CONF_EVENT)
    offset = config.get(CONF_OFFSET)
    @callback
    def call_action():
        'Call    action    with    right    context.'
        hass.async_run_job(action, {'trigger': {'platform': 'sun', 'event': event, 'offset': offset}})
    if (event == SUN_EVENT_SUNRISE):
        return async_track_sunrise(hass, call_action, offset)
    return async_track_sunset(hass, call_action, offset)