code: def _cnvbed_to_bed(in_file, caller, out_file):
      
      with open(out_file, "w") as out_handle:
          for feat in pybedtools.BedTool(in_file):
              out_handle.write("\t".join([feat.chrom, str(feat.start), str(feat.end),
                                          "cnv%s_%s" % (feat.score, caller)])
                               + "\n")
docs: Convert cn_mops CNV based bed files into flattened BED