code: func (p *PriorityQueue) getUnschedulablePodsWithMatchingAffinityTerm(pod *v1.Pod) []*podInfo {
  	var podsToMove []*podInfo
  	for _, pInfo := range p.unschedulableQ.podInfoMap {
  		up := pInfo.pod
  		affinity := up.Spec.Affinity
  		if affinity != nil && affinity.PodAffinity != nil {
  			terms := predicates.GetPodAffinityTerms(affinity.PodAffinity)
  			for _, term := range terms {
  				namespaces := priorityutil.GetNamespacesFromPodAffinityTerm(up, &term)
  				selector, err := metav1.LabelSelectorAsSelector(term.LabelSelector)
  				if err != nil {
  					klog.Errorf("Error getting label selectors for pod: %v.", up.Name)
  				}
  				if priorityutil.PodMatchesTermsNamespaceAndSelector(pod, namespaces, selector) {
  					podsToMove = append(podsToMove, pInfo)
  					break
  				}
  			}
  		}
  	}
  	return podsToMove
  }
docs: // getUnschedulablePodsWithMatchingAffinityTerm returns unschedulable pods which have
  // any affinity term that matches "pod".
  // NOTE: this function assumes lock has been acquired in caller.