code: func Networks(namespace Namespace, networks networkMap, servicesNetworks map[string]struct{}) (map[string]types.NetworkCreate, []string) {
  	if networks == nil {
  		networks = make(map[string]composetypes.NetworkConfig)
  	}
  
  	externalNetworks := []string{}
  	result := make(map[string]types.NetworkCreate)
  	for internalName := range servicesNetworks {
  		network := networks[internalName]
  		if network.External.External {
  			externalNetworks = append(externalNetworks, network.Name)
  			continue
  		}
  
  		createOpts := types.NetworkCreate{
  			Labels:     AddStackLabel(namespace, network.Labels),
  			Driver:     network.Driver,
  			Options:    network.DriverOpts,
  			Internal:   network.Internal,
  			Attachable: network.Attachable,
  		}
  
  		if network.Ipam.Driver != "" || len(network.Ipam.Config) > 0 {
  			createOpts.IPAM = &networktypes.IPAM{}
  		}
  
  		if network.Ipam.Driver != "" {
  			createOpts.IPAM.Driver = network.Ipam.Driver
  		}
  		for _, ipamConfig := range network.Ipam.Config {
  			config := networktypes.IPAMConfig{
  				Subnet: ipamConfig.Subnet,
  			}
  			createOpts.IPAM.Config = append(createOpts.IPAM.Config, config)
  		}
  
  		networkName := namespace.Scope(internalName)
  		if network.Name != "" {
  			networkName = network.Name
  		}
  		result[networkName] = createOpts
  	}
  
  	return result, externalNetworks
  }
docs: // Networks from the compose-file type to the engine API type