code: func (s *StoreToDeploymentLister) GetDeploymentsForReplicaSet(rs *extensions.ReplicaSet) (deployments []extensions.Deployment, err error) {
  	var d extensions.Deployment
  
  	if len(rs.Labels) == 0 {
  		err = fmt.Errorf("no deployments found for ReplicaSet %v because it has no labels", rs.Name)
  		return
  	}
  
  	// TODO: MODIFY THIS METHOD so that it checks for the podTemplateSpecHash label
  	for _, m := range s.Store.List() {
  		d = *m.(*extensions.Deployment)
  		if d.Namespace != rs.Namespace {
  			continue
  		}
  
  		selector, err := unversioned.LabelSelectorAsSelector(d.Spec.Selector)
  		if err != nil {
  			return nil, fmt.Errorf("invalid label selector: %v", err)
  		}
  		// If a deployment with a nil or empty selector creeps in, it should match nothing, not everything.
  		if selector.Empty() || !selector.Matches(labels.Set(rs.Labels)) {
  			continue
  		}
  		deployments = append(deployments, d)
  	}
  	if len(deployments) == 0 {
  		err = fmt.Errorf("could not find deployments set for ReplicaSet %s in namespace %s with labels: %v", rs.Name, rs.Namespace, rs.Labels)
  	}
  	return
  }
docs: // GetDeploymentsForReplicaSet returns a list of deployments managing a replica set. Returns an error only if no matching deployments are found.