code: func (daemon *Daemon) FindNetwork(term string) (libnetwork.Network, error) {
  	listByFullName := []libnetwork.Network{}
  	listByPartialID := []libnetwork.Network{}
  	for _, nw := range daemon.getAllNetworks() {
  		if nw.ID() == term {
  			return nw, nil
  		}
  		if nw.Name() == term {
  			listByFullName = append(listByFullName, nw)
  		}
  		if strings.HasPrefix(nw.ID(), term) {
  			listByPartialID = append(listByPartialID, nw)
  		}
  	}
  	switch {
  	case len(listByFullName) == 1:
  		return listByFullName[0], nil
  	case len(listByFullName) > 1:
  		return nil, errdefs.InvalidParameter(errors.Errorf("network %s is ambiguous (%d matches found on name)", term, len(listByFullName)))
  	case len(listByPartialID) == 1:
  		return listByPartialID[0], nil
  	case len(listByPartialID) > 1:
  		return nil, errdefs.InvalidParameter(errors.Errorf("network %s is ambiguous (%d matches found based on ID prefix)", term, len(listByPartialID)))
  	}
  
  	// Be very careful to change the error type here, the
  	// libnetwork.ErrNoSuchNetwork error is used by the controller
  	// to retry the creation of the network as managed through the swarm manager
  	return nil, errdefs.NotFound(libnetwork.ErrNoSuchNetwork(term))
  }
docs: // FindNetwork returns a network based on:
  // 1. Full ID
  // 2. Full Name
  // 3. Partial ID
  // as long as there is no ambiguity