human
Here's a good function header given the following:
I wrote the below code

    conf = config[DOMAIN]
    token = conf.get(CONF_TOKEN)
    le_wh = '{}{}'.format(DEFAULT_HOST, token)
    def logentries_event_listener(event):
        'Listen    for    new    messages    on    the    bus    and    sends    them    to    Logentries.'
        state = event.data.get('new_state')
        if (state is None):
            return
        try:
            _state = state_helper.state_as_number(state)
        except ValueError:
            _state = state.state
        json_body = [{'domain': state.domain, 'entity_id': state.object_id, 'attributes': dict(state.attributes), 'time': str(event.time_fired), 'value': _state}]
        try:
            payload = {'host': le_wh, 'event': json_body}
            requests.post(le_wh, data=json.dumps(payload), timeout=10)
        except requests.exceptions.RequestException as error:
            _LOGGER.exception('Error    sending    to    Logentries:    %s', error)
    hass.bus.listen(EVENT_STATE_CHANGED, logentries_event_listener)
    return True

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

def setup(hass, config):