human
I wrote the below code

    if (DATA_SOUNDTOUCH not in hass.data):
        hass.data[DATA_SOUNDTOUCH] = []
    if discovery_info:
        host = discovery_info['host']
        port = int(discovery_info['port'])
        if (host in [device.config['host'] for device in hass.data[DATA_SOUNDTOUCH]]):
            return
        remote_config = {'id': 'ha.component.soundtouch', 'host': host, 'port': port}
        soundtouch_device = SoundTouchDevice(None, remote_config)
        hass.data[DATA_SOUNDTOUCH].append(soundtouch_device)
        add_devices([soundtouch_device])
    else:
        name = config.get(CONF_NAME)
        remote_config = {'id': 'ha.component.soundtouch', 'port': config.get(CONF_PORT), 'host': config.get(CONF_HOST)}
        soundtouch_device = SoundTouchDevice(name, remote_config)
        hass.data[DATA_SOUNDTOUCH].append(soundtouch_device)
        add_devices([soundtouch_device])
    descriptions = load_yaml_config_file(path.join(path.dirname(__file__), 'services.yaml'))
    def service_handle(service):
        'Handle    the    applying    of    a    service.'
        master_device_id = service.data.get('master')
        slaves_ids = service.data.get('slaves')
        slaves = []
        if slaves_ids:
            slaves = [device for device in hass.data[DATA_SOUNDTOUCH] if (device.entity_id in slaves_ids)]
        master = next([device for device in hass.data[DATA_SOUNDTOUCH] if (device.entity_id == master_device_id)].__iter__(), None)
        if (master is None):
            _LOGGER.warning('Unable    to    find    master    with    entity_id:    %s', str(master_device_id))
            return
        if (service.service == SERVICE_PLAY_EVERYWHERE):
            slaves = [d for d in hass.data[DATA_SOUNDTOUCH] if (d.entity_id != master_device_id)]
            master.create_zone(slaves)
        elif (service.service == SERVICE_CREATE_ZONE):
            master.create_zone(slaves)
        elif (service.service == SERVICE_REMOVE_ZONE_SLAVE):
            master.remove_zone_slave(slaves)
        elif (service.service ==...

What's a good function header?
assistant
#Here is Python program to find    master    with    entity_id:    %s', str(master_device_id))
.

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