code: def _select_background_cnns(cnns):
      
      min_for_variability_analysis = 20
      pct_keep = 0.10
      b_cnns = [x for x in cnns if x["itype"] == "background" and x.get("metrics")]
      assert len(b_cnns) % 2 == 0, "Expect even set of target/antitarget cnns for background"
      if len(b_cnns) >= min_for_variability_analysis:
          b_cnns_w_metrics = []
          for b_cnn in b_cnns:
              unreliability = b_cnn["metrics"]["segments"] * b_cnn["metrics"]["bivar"]
              b_cnns_w_metrics.append((unreliability, b_cnn))
          b_cnns_w_metrics.sort()
          to_keep = int(math.ceil(pct_keep * len(b_cnns) / 2.0) * 2)
          b_cnns = [x[1] for x in b_cnns_w_metrics][:to_keep]
          assert len(b_cnns) % 2 == 0, "Expect even set of target/antitarget cnns for background"
      return [x["file"] for x in b_cnns]
docs: Select cnns to use for background calculations.
  
      Uses background samples in cohort, and will remove CNNs with high
      on target variability. Uses (number of segments * biweight midvariance) as metric
      for variability with higher numbers being more unreliable.