human
I wrote the below code

    import pywink
    for lock in pywink.get_locks():
        _id = (lock.object_id() + lock.name())
        if (_id not in hass.data[DOMAIN]['unique_ids']):
            add_devices([WinkLockDevice(lock, hass)])
    def service_handle(service):
        'Handler    for    services.'
        entity_ids = service.data.get('entity_id')
        all_locks = hass.data[DOMAIN]['entities']['lock']
        locks_to_set = []
        if (entity_ids is None):
            locks_to_set = all_locks
        else:
            for lock in all_locks:
                if (lock.entity_id in entity_ids):
                    locks_to_set.append(lock)
        for lock in locks_to_set:
            if (service.service == SERVICE_SET_VACATION_MODE):
                lock.set_vacation_mode(service.data.get(ATTR_ENABLED))
            elif (service.service == SERVICE_SET_ALARM_STATE):
                lock.set_alarm_state(service.data.get(ATTR_ENABLED))
            elif (service.service == SERVICE_SET_BEEPER_STATE):
                lock.set_beeper_state(service.data.get(ATTR_ENABLED))
            elif (service.service == SERVICE_SET_ALARM_MODE):
                lock.set_alarm_mode(service.data.get(ATTR_MODE))
            elif (service.service == SERVICE_SET_ALARM_SENSITIVITY):
                lock.set_alarm_sensitivity(service.data.get(ATTR_SENSITIVITY))
    descriptions = load_yaml_config_file(path.join(path.dirname(__file__), 'services.yaml'))
    hass.services.register(DOMAIN, SERVICE_SET_VACATION_MODE, service_handle, descriptions.get(SERVICE_SET_VACATION_MODE), schema=SET_ENABLED_SCHEMA)
    hass.services.register(DOMAIN, SERVICE_SET_ALARM_STATE, service_handle, descriptions.get(SERVICE_SET_ALARM_STATE), schema=SET_ENABLED_SCHEMA)
    hass.services.register(DOMAIN, SERVICE_SET_BEEPER_STATE, service_handle, descriptions.get(SERVICE_SET_BEEPER_STATE), schema=SET_ENABLED_SCHEMA)
    hass.services.register(DOMAIN, SERVICE_SET_ALARM_MODE, service_handle, descriptions.get(SERVICE_SET_ALARM_MODE), schema=SET_ALARM_MODES_SCHEMA)
   ...

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

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