human
I wrote the below code

    logger = logging.getLogger(__name__)
    device_tracker = get_component('device_tracker')
    group = get_component('group')
    light = get_component('light')
    conf = config[DOMAIN]
    disable_turn_off = conf.get(CONF_DISABLE_TURN_OFF)
    light_group = conf.get(CONF_LIGHT_GROUP, light.ENTITY_ID_ALL_LIGHTS)
    light_profile = conf.get(CONF_LIGHT_PROFILE)
    device_group = conf.get(CONF_DEVICE_GROUP, device_tracker.ENTITY_ID_ALL_DEVICES)
    device_entity_ids = group.get_entity_ids(hass, device_group, device_tracker.DOMAIN)
    if (not device_entity_ids):
        logger.error('No    devices    found    to    track')
        return False
    light_ids = group.get_entity_ids(hass, light_group, light.DOMAIN)
    if (not light_ids):
        logger.error('No    lights    found    to    turn    on')
        return False
    def calc_time_for_light_when_sunset():
        'Calculate    the    time    when    to    start    fading    lights    in    when    sun    sets.\n\n                                Returns    None    if    no    next_setting    data    available.\n\n                                Async    friendly.\n                                '
        next_setting = get_astral_event_next(hass, 'sunset')
        if (not next_setting):
            return None
        return (next_setting - (LIGHT_TRANSITION_TIME * len(light_ids)))
    def async_turn_on_before_sunset(light_id):
        'Turn    on    lights.'
        if ((not device_tracker.is_on(hass)) or light.is_on(hass, light_id)):
            return
        light.async_turn_on(hass, light_id, transition=LIGHT_TRANSITION_TIME.seconds, profile=light_profile)
    def async_turn_on_factory(light_id):
        'Generate    turn    on    callbacks    as    factory.'
        @callback
        def async_turn_on_light(now):
            'Turn    on    specific    light.'
            async_turn_on_before_sunset(light_id)
        return async_turn_on_light
    @callback
    def schedule_light_turn_on(now):
        'Turn    on    all    the    lights    at ...

What's a good function header?
 ... Write me a Python code to calculate    the    time    when    to    start    fading    lights    in    when    sun    sets?
assistant
#Here is Python code to calculate    the    time    when    to    start    fading    lights    in    when    sun    sets.

@asyncio.coroutine
def async_setup(hass, config):