human
I wrote the below code

    conf = config[DOMAIN]
    host = conf.get(CONF_HOST)
    port = conf.get(CONF_PORT)
    token = conf.get(CONF_TOKEN)
    use_ssl = conf.get(CONF_SSL)
    name = conf.get(CONF_NAME)
    if use_ssl:
        uri_scheme = 'https://'
    else:
        uri_scheme = 'http://'
    event_collector = '{}{}:{}/services/collector/event'.format(uri_scheme, host, port)
    headers = {'Authorization': 'Splunk    {}'.format(token)}
    def splunk_event_listener(event):
        'Listen    for    new    messages    on    the    bus    and    sends    them    to    Splunk.'
        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, 'host': name}]
        try:
            payload = {'host': event_collector, 'event': json_body}
            requests.post(event_collector, data=json.dumps(payload), headers=headers, timeout=10)
        except requests.exceptions.RequestException as error:
            _LOGGER.exception('Error    saving    event    to    Splunk:    %s', error)
    hass.bus.listen(EVENT_STATE_CHANGED, splunk_event_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):