def get_device_id(client, device_name):
    """
    Helper function to get device ID by its name.
    """
    devices = client.devices()
    device_id = None
    if not devices or not 'devices' in devices or len(devices['devices']) == 0:
        raise Exception('no devices online')
    for dev in devices['devices']:
        if dev['name'] == device_name:
            device_id = dev['id']
            break
    if not device_id:
        raise Exception(f"device '{device_name}' is not online")
    return device_id