def get_device_name(device):
    """
    Find the name of a device fetched from the project device list.
    Returns the device identifier if no name is explicitly given.

    Parameters
    ----------
    device : dict
        Dictionary of device information fetched by the API.

    Returns
    -------
    name : string
        Given name or identifier of device.

    """

    # check if label name exists
    if 'name' in device['labels'].keys():
        return device['labels']['name']
    else:
        return device['name'].split('/')[-1]