def METHOD_NAME(cls, instance, cleaned_input):
    try:
        cleaned_input = validate_slug_and_generate_if_needed(
            instance, "name", cleaned_input
        )
    except ValidationError as error:
        error.code = AttributeErrorCode.REQUIRED.value
        raise ValidationError({"slug": error})
    cls._clean_attribute_settings(instance, cleaned_input)
    return cleaned_input