def METHOD_NAME(
    cls, instance, instance_type, attribute_id: str, error_code_enum
):
    attribute_pk = cls.get_global_id_or_error(
        attribute_id, only_type=Attribute, field="attribute_id"
    )
    try:
        attribute_assignment = instance.attributes.prefetch_related("values").get(
            assignment__attribute_id=attribute_pk
        )
    except ObjectDoesNotExist:
        raise ValidationError(
            {
                "attribute_id": ValidationError(
                    f"Couldn't resolve to a {instance_type} "
                    f"attribute: {attribute_id}.",
                    code=error_code_enum.NOT_FOUND.value,
                )
            }
        )
    return attribute_assignment