code: func getContainersToDeleteInPod(filterContainerID string, podStatus *kubecontainer.PodStatus, containersToKeep int) containerStatusbyCreatedList {
  	matchedContainer := func(filterContainerId string, podStatus *kubecontainer.PodStatus) *kubecontainer.ContainerStatus {
  		if filterContainerId == "" {
  			return nil
  		}
  		for _, containerStatus := range podStatus.ContainerStatuses {
  			if containerStatus.ID.ID == filterContainerId {
  				return containerStatus
  			}
  		}
  		return nil
  	}(filterContainerID, podStatus)
  
  	if filterContainerID != "" && matchedContainer == nil {
  		klog.Warningf("Container %q not found in pod's containers", filterContainerID)
  		return containerStatusbyCreatedList{}
  	}
  
  	// Find the exited containers whose name matches the name of the container with id being filterContainerId
  	var candidates containerStatusbyCreatedList
  	for _, containerStatus := range podStatus.ContainerStatuses {
  		if containerStatus.State != kubecontainer.ContainerStateExited {
  			continue
  		}
  		if matchedContainer == nil || matchedContainer.Name == containerStatus.Name {
  			candidates = append(candidates, containerStatus)
  		}
  	}
  
  	if len(candidates) <= containersToKeep {
  		return containerStatusbyCreatedList{}
  	}
  	sort.Sort(candidates)
  	return candidates[containersToKeep:]
  }
docs: // getContainersToDeleteInPod returns the exited containers in a pod whose name matches the name inferred from filterContainerId (if not empty), ordered by the creation time from the latest to the earliest.
  // If filterContainerID is empty, all dead containers in the pod are returned.