human
I wrote the below code

    bt_device_id = config.get('bt_device_id')
    beacons = config.get('beacons')
    devices = []
    for (dev_name, properties) in beacons.items():
        namespace = get_from_conf(properties, 'namespace', 20)
        instance = get_from_conf(properties, 'instance', 12)
        name = properties.get(CONF_NAME, dev_name)
        if ((instance is None) or (namespace is None)):
            _LOGGER.error('Skipping    %s', dev_name)
            continue
        else:
            devices.append(EddystoneTemp(name, namespace, instance))
    if devices:
        mon = Monitor(hass, devices, bt_device_id)
        def monitor_stop(_service_or_event):
            'Stop    the    monitor    thread.'
            _LOGGER.info('Stopping    scanner    for    Eddystone    beacons')
            mon.stop()
        def monitor_start(_service_or_event):
            'Start    the    monitor    thread.'
            _LOGGER.info('Starting    scanner    for    Eddystone    beacons')
            mon.start()
        add_devices(devices)
        mon.start()
        hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, monitor_stop)
        hass.bus.listen_once(EVENT_HOMEASSISTANT_START, monitor_start)
    else:
        _LOGGER.warning('No    devices    were    added')

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

def setup_platform(hass, config, add_devices, discovery_info=None):