You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ipam.go
    path of file: ./repos/moby/api/types/network
    
    the code of the file until where you have to start completion: package network

import (
	"errors"
	"fmt"
	"net/netip"

	"github.com/docker/docker/internal/multierror"
)

// IPAM represents IP Address Management
type IPAM struct {
	Driver  string
	Options map[string]string // Per network IPAM driver options
	Config  []IPAMConfig
}

// IPAMConfig represents IPAM configurations
type IPAMConfig struct {
	Subnet     string            `json:",omitempty"`
	IPRange    string            `json:",omitempty"`
	Gateway    string            `json:",omitempty"`
	AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"`
}

type ipFamily string

const (
	ip4 ipFamily = "IPv4"
	ip6 ipFamily = "IPv6"
)

// ValidateIPAM checks whether the network's IPAM passed as argument is valid. It returns a joinError of the list of
// errors found.
func ValidateIPAM(ipam *IPAM, enableIPv6 bool) error {
	if ipam == nil {
		return nil
	}

	var errs []error
	for _, 
    
func ValidateIPAM(ipam *IPAM, enableIPv6 bool) error {
	if ipam == nil {
		return nil
	}

	var errs []error
	for _, cfg := range ipam.Config {
		subnet, err := netip.ParsePrefix(cfg.Subnet)
		if err != nil {
			errs = append(errs, fmt.Errorf("invalid subnet %s: invalid CIDR block notation", cfg.Subnet))
			continue
		}
		subnetFamily := ip4
		if subnet.Addr().Is6() {
			subnetFamily = ip6
		}

		if !enableIPv6 && subnetFamily == ip6 {
			continue
		}

		if subnet != subnet.Masked() {
			errs = append(errs, fmt.Errorf("invalid subnet %s: it should be %s", subnet, subnet.Masked()))
		}

		if ipRangeErrs := validateIPRange(cfg.IPRange, subnet, subnetFamily); len(ipRangeErrs) > 0 {
			errs = append(errs, ipRangeErrs...)
		}

		if err := validateAddress(cfg.Gateway, subnet, subnetFamily); err != nil {
			errs = append(errs, fmt.Errorf("invalid gateway %s: %w", cfg.Gateway, err))
		}

		for auxName, aux := range cfg.AuxAddress {
			if err := validateAddress(aux, subnet, subnetFamily); err != nil {
				errs = append(errs, fmt.Errorf("invalid auxiliary address %s: %w", auxName, err))
			}
		}
	}

	if err := multierror.Join(errs...); err != nil {
		return fmt.Errorf("invalid network config:\n%w", err)
	}

	return nil
}