def METHOD_NAME(cls, info: ResolveInfo, instance, data, **kwargs):
    code = data.get("code", None)
    if code == "":
        data["code"] = generate_promo_code()
    elif not is_available_promo_code(code):
        raise ValidationError(
            {
                "code": ValidationError(
                    "Promo code already exists.",
                    code=DiscountErrorCode.ALREADY_EXISTS.value,
                )
            }
        )
    cleaned_input = super().METHOD_NAME(info, instance, data, **kwargs)
    return cleaned_input