human
I wrote the below code

    import thingspeak
    conf = config[DOMAIN]
    api_key = conf.get(CONF_API_KEY)
    channel_id = conf.get(CONF_ID)
    entity = conf.get(CONF_WHITELIST)
    try:
        channel = thingspeak.Channel(channel_id, write_key=api_key, timeout=TIMEOUT)
        channel.get()
    except RequestException:
        _LOGGER.error('Error    while    accessing    the    ThingSpeak    channel.    Please    check    that    the    channel    exists    and    your    API    key    is    correct.')
        return False
    def thingspeak_listener(entity_id, old_state, new_state):
        'Listen    for    new    events    and    send    them    to    Thingspeak.'
        if ((new_state is None) or (new_state.state in (STATE_UNKNOWN, '', STATE_UNAVAILABLE))):
            return
        try:
            if (new_state.entity_id != entity):
                return
            _state = state_helper.state_as_number(new_state)
        except ValueError:
            return
        try:
            channel.update({'field1': _state})
        except RequestException:
            _LOGGER.error("Error    while    sending    value    '%s'    to    Thingspeak", _state)
    event.track_state_change(hass, entity, thingspeak_listener)
    return True

What's a good function header?
 Here's a good function header?
assistant
#Here's a good function header.

def setup(hass, config):