def udn_from_usn(usn: str, device_type: str):
    """
    Extract the device UUID from a Unique Service Name.

    This only works for USNs that describe devices include the device type, not services or root devices

    Parameters
    -----------
    usn : str
        Unique Service Name in the form 'uuid:{device-UUID}::rn:schemas-upnp-org:device:{deviceType}:{ver}'
    device_type : str
        Device type descriptor in the form 'urn:schemas-upnp-org:device:{deviceType}:{ver}'

    Returns
    -------
    str
        Device UUID
    """
    return usn.replace(f'::{device_type}', '').lstrip('uuid:')