code: func GetNewReplicaSetFromList(deployment extensions.Deployment, c clientset.Interface, getRSList func(string, api.ListOptions) ([]extensions.ReplicaSet, error)) (*extensions.ReplicaSet, error) {
  	namespace := deployment.ObjectMeta.Namespace
  	selector, err := unversioned.LabelSelectorAsSelector(deployment.Spec.Selector)
  	if err != nil {
  		return nil, fmt.Errorf("invalid label selector: %v", err)
  	}
  
  	rsList, err := getRSList(namespace, api.ListOptions{LabelSelector: selector})
  	if err != nil {
  		return nil, fmt.Errorf("error listing ReplicaSets: %v", err)
  	}
  	newRSTemplate := GetNewReplicaSetTemplate(deployment)
  
  	for i := range rsList {
  		if api.Semantic.DeepEqual(rsList[i].Spec.Template, &newRSTemplate) {
  			// This is the new ReplicaSet.
  			return &rsList[i], nil
  		}
  	}
  	// new ReplicaSet does not exist.
  	return nil, nil
  }
docs: // GetNewReplicaSetFromList returns a replica set that matches the intent of the given deployment; get ReplicaSetList with the input function.
  // Returns nil if the new replica set doesn't exist yet.