code: def write_rttm2manifest(
      AUDIO_RTTM_MAP: str,
      manifest_file: str,
      include_uniq_id: bool = False,
      decimals: int = 5,
  ) -> str:
      """
      Write manifest file based on rttm files (or vad table out files). This manifest file would be used by
      speaker diarizer to compute embeddings and cluster them. This function takes care of overlapping VAD timestamps
      and trimmed with the given offset and duration value.
  
      Args:
          AUDIO_RTTM_MAP (dict):
              Dictionary containing keys to unique names, that contains audio filepath and rttm_filepath as its contents,
              these are used to extract oracle vad timestamps.
          manifest (str):
              The path to the output manifest file.
  
      Returns:
          manifest (str):
              The path to the output manifest file.
      """
      with open(manifest_file, "w") as outfile:
          for uniq_id in AUDIO_RTTM_MAP:
              rttm_file_path = AUDIO_RTTM_MAP[uniq_id]["rttm_filepath"]
              rttm_lines = read_rttm_lines(rttm_file_path)
              offset, duration = get_offset_and_duration(
                  AUDIO_RTTM_MAP, uniq_id, decimals
              )
              vad_start_end_list_raw = []
              for line in rttm_lines:
                  start, dur = get_vad_out_from_rttm_line(line)
                  vad_start_end_list_raw.append([start, start + dur])
              vad_start_end_list = merge_float_intervals(
                  vad_start_end_list_raw, decimals
              )
              if len(vad_start_end_list) == 0:
                  logging.warning(
                      f"File ID: {uniq_id}: The VAD label is not containing any speech segments."
                  )
              elif duration <= 0:
                  logging.warning(
                      f"File ID: {uniq_id}: The audio file has negative or zero duration."
                  )
              else:
                  overlap_range_list = get_sub_range_list(
                      source_range_list=vad_start_end_list,
                      target_range=[offset, offset + duration],
                  )
                  write_overlap_segments(
                      outfile,
                      AUDIO_RTTM_MAP,
                      uniq_id,
                      overlap_range_list,
                      decimals,
                  )
      return manifest_file
  
imports: import gc
  import json
  import math
  import os
  import shutil
  from copy import deepcopy
  from typing import Dict, List, Tuple, Union
  import numpy
  import omegaconf
  import soundfile
  import torch
  from pyannote.core import Annotation, Segment
  from tqdm import tqdm
  from nemo.collections.asr.data.audio_to_label import repeat_signal
  from nemo.collections.asr.parts.utils.longform_clustering import LongFormSpeakerClustering
  from nemo.collections.asr.parts.utils.offline_clustering import SpeakerClustering, get_argmin_mat, split_input_data
  from nemo.utils import logging
label_desc: Use image node_id 30 for calling a global function with example usage: write_rttm2manifest(AUDIO_RTTM_MAP, manifest_file, include_uniq_id, decimals) and returns: manifest_file