code: def handle_synonyms(in_file, ref_file, genome_build, work_dir, data):
      
      if genome_build in GMAP and ref_file:
          mappings = GMAP[genome_build]
          contigs = set([c.name for c in ref.file_contigs(ref_file)])
          out_file = os.path.join(work_dir, "%s-fixed_contigs%s" % utils.splitext_plus(os.path.basename(in_file)))
          if not utils.file_exists(out_file):
              if out_file.endswith(".gz"):
                  out_file = out_file.replace(".gz", "")
                  needs_bgzip = True
              else:
                  needs_bgzip = False
              checked_file = "%s.checked" % utils.splitext_plus(out_file)[0]
              if not _matches_contigs(in_file, contigs, checked_file):
                  with file_transaction(data, out_file) as tx_out_file:
                      _write_newname_file(in_file, tx_out_file, mappings)
                  if needs_bgzip:
                      out_file = vcfutils.bgzip_and_index(out_file, data["config"])
                  return out_file
      return in_file
docs: Potentially handle remapping synonymous chromosome names between builds.
  
      Handles tab delimited file formats like BED and VCF where the contig
      is in the first column.