code: def cnvkit_background(background_cnns, out_file, items, target_bed=None, antitarget_bed=None):
      
      if not utils.file_exists(out_file):
          with file_transaction(items[0], out_file) as tx_out_file:
              cmd = [_get_cmd(), "reference", "-f", dd.get_ref_file(items[0]), "-o", tx_out_file]
              gender = _get_batch_gender(items)
              if gender:
                  cmd += ["--sample-sex", gender]
              if len(background_cnns) == 0:
                  assert target_bed and antitarget_bed, "Missing CNNs and target BEDs for flat background"
                  cmd += ["-t", target_bed, "-a", antitarget_bed]
              else:
                  cmd += background_cnns
              do.run(_prep_cmd(cmd, tx_out_file), "CNVkit background")
      return out_file
docs: Calculate background reference, handling flat case with no normal sample.