code: def prepare_segs_for_RTTM(
      list_ids,
      out_rttm_file,
      audio_dir,
      annot_dir,
      split_type,
      skip_TNO,
  ):
      RTTM = (
          []
      )  # Stores all RTTMs clubbed together for a given dataset split
  
      for main_meet_id in list_ids:
          # Skip TNO meetings from dev and eval sets
          if (
              main_meet_id.startswith("TS")
              and split_type != "train"
              and skip_TNO is True
          ):
              msg = (
                  "Skipping TNO meeting in AMI "
                  + str(split_type)
                  + " set : "
                  + str(main_meet_id)
              )
              logger.info(msg)
              continue
  
          list_sessions = glob.glob(
              audio_dir + "/" + main_meet_id + "*"
          )
          list_sessions.sort()
  
          for sess in list_sessions:
              rec_id = os.path.basename(sess)
              path = annot_dir + "/segments/" + rec_id
              f = path + ".*.segments.xml"
              list_spkr_xmls = glob.glob(f)
              list_spkr_xmls.sort()  # A, B, C, D, E etc (Speakers)
              segs = []
              spkrs_list = (
                  []
              )  # Since non-scenario recordings contains 3-5 speakers
  
              for spkr_xml_file in list_spkr_xmls:
                  # Speaker ID
                  spkr = os.path.basename(spkr_xml_file).split(".")[1]
                  spkr_ID = rec_id + "." + spkr
                  spkrs_list.append(spkr_ID)
  
                  # Parse xml tree
                  tree = et.parse(spkr_xml_file)
                  root = tree.getroot()
  
                  # Start, end and speaker_ID from xml file
                  segs = segs + [
                      [
                          elem.attrib["transcriber_start"],
                          elem.attrib["transcriber_end"],
                          spkr_ID,
                      ]
                      for elem in root.iter("segment")
                  ]
  
              # Sort rows as per the start time (per recording)
              segs.sort(key=lambda x: float(x[0]))
  
              rttm_per_rec = get_RTTM_per_rec(segs, spkrs_list, rec_id)
              RTTM = RTTM + rttm_per_rec
  
      # Write one RTTM as groundtruth. For example, "fullref_eval.rttm"
      with open(out_rttm_file, "w") as f:
          for item in RTTM:
              f.write("%s\n" % item)
  
file_path: speechbrain/recipes/AMI/ami_prepare.py
imports: import os
  import logging
  import xml.etree.ElementTree
  import glob
  import json
  from ami_splits import get_AMI_split
  from speechbrain.dataio.dataio import load_pkl, save_pkl
label_desc: Use image node_id 3 for calling a global function with example usage: prepare_segs_for_RTTM(list_ids, out_rttm_file, audio_dir, annot_dir, split_type, skip_TNO) without return types