code: func ResolveServiceNetworks(ctx context.Context, c api.ControlClient, spec *api.ServiceSpec) error {
  	if len(spec.Task.Networks) == 0 {
  		return nil
  	}
  	networks := make([]*api.NetworkAttachmentConfig, 0, len(spec.Task.Networks))
  	for _, na := range spec.Task.Networks {
  		n, err := GetNetwork(ctx, c, na.Target)
  		if err != nil {
  			return err
  		}
  
  		networks = append(networks, &api.NetworkAttachmentConfig{
  			Target: n.ID,
  		})
  	}
  
  	spec.Task.Networks = networks
  	return nil
  }
docs: // ResolveServiceNetworks takes a service spec and resolves network names to network IDs.