code: func ValidateNetworkPolicyPeer(peer *networking.NetworkPolicyPeer, peerPath *field.Path) field.ErrorList {
  	allErrs := field.ErrorList{}
  	numPeers := 0
  
  	if peer.PodSelector != nil {
  		numPeers++
  		allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(peer.PodSelector, peerPath.Child("podSelector"))...)
  	}
  	if peer.NamespaceSelector != nil {
  		numPeers++
  		allErrs = append(allErrs, unversionedvalidation.ValidateLabelSelector(peer.NamespaceSelector, peerPath.Child("namespaceSelector"))...)
  	}
  	if peer.IPBlock != nil {
  		numPeers++
  		allErrs = append(allErrs, ValidateIPBlock(peer.IPBlock, peerPath.Child("ipBlock"))...)
  	}
  
  	if numPeers == 0 {
  		allErrs = append(allErrs, field.Required(peerPath, "must specify a peer"))
  	} else if numPeers > 1 && peer.IPBlock != nil {
  		allErrs = append(allErrs, field.Forbidden(peerPath, "may not specify both ipBlock and another peer"))
  	}
  
  	return allErrs
  }
docs: // ValidateNetworkPolicyPeer validates a NetworkPolicyPeer