def METHOD_NAME(
    checkout_info: "CheckoutInfo",
    lines: Iterable["CheckoutLineInfo"],
    error_code: Union[
        Type[CheckoutErrorCode],
        Type[PaymentErrorCode],
        Type[OrderCreateFromCheckoutErrorCode],
    ],
):
    delivery_method_info = checkout_info.delivery_method_info
    if is_shipping_required(lines):
        if not delivery_method_info.delivery_method:
            raise ValidationError(
                {
                    "shipping_method": ValidationError(
                        "Shipping method is not set",
                        code=error_code.SHIPPING_METHOD_NOT_SET.value,
                    )
                }
            )
        if not delivery_method_info.is_valid_delivery_method():
            raise ValidationError(
                {
                    "shipping_address": ValidationError(
                        "Shipping address is not set",
                        code=error_code.SHIPPING_ADDRESS_NOT_SET.value,
                    )
                }
            )
        if not delivery_method_info.is_method_in_valid_methods(checkout_info):
            clear_delivery_method(checkout_info)
            raise ValidationError(
                {
                    "shipping_method": ValidationError(
                        "Delivery method is not valid for your shipping address",
                        code=error_code.INVALID_SHIPPING_METHOD.value,
                    )
                }
            )