code: def labels_to_rttmfile(labels, uniq_id, filename, out_rttm_dir):
      """
      Write rttm file with uniq_id name in out_rttm_dir with time_stamps in labels
      """
      filename = os.path.join(out_rttm_dir, filename + ".rttm")
      with open(filename, "w") as f:
          for line in labels:
              line = line.strip()
              start, end, speaker = line.split()
              duration = float(end) - float(start)
              start = float(start)
              log = "SPEAKER {} 1   {:.3f}   {:.3f} <NA> <NA> {} <NA> <NA>\n".format(
                  uniq_id, start, duration, speaker
              )
              f.write(log)
  
      return filename
  
file_path: NeMo/scripts/speaker_tasks/create_msdd_train_dataset.py
imports: import argparse
  import copy
  import itertools
  import os
  import random
  from tqdm import tqdm
  from nemo.collections.asr.parts.utils.manifest_utils import get_input_manifest_dict, get_subsegment_dict, rreplace, write_truncated_subsegments
  from nemo.collections.asr.parts.utils.speaker_utils import audio_rttm_map, rttm_to_labels, segments_manifest_to_subsegments_manifest, write_rttm2manifest
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: labels_to_rttmfile(labels, uniq_id, filename, out_rttm_dir) and returns: filename