def METHOD_NAME(token):
    payload = signing.loads(token, salt="zentral_mdm_legacy_profile")
    # profile
    artifact_version = ArtifactVersion.objects.select_related("profile").get(
        pk=payload["avpk"],
        artifact__type=Artifact.Type.PROFILE
    )
    # enrollment session
    es_ct = ContentType.objects.get_by_natural_key("mdm", payload["esm"])
    enrollment_session = (es_ct.model_class()
                               .objects
                               .select_related("enrolled_device", "realm_user")
                               .get(pk=payload["espk"]))
    # enrolled user
    try:
        enrolled_user = EnrolledUser.objects.get(pk=payload["eupk"])
    except KeyError:
        enrolled_user = None
    return artifact_version.profile, enrollment_session, enrolled_user