code: def split_into_pairwise_rttm(
      audio_rttm_map, input_manifest_path, output_dir
  ):
      """
      Create pairwise RTTM files and save it to `output_dir`. This function picks two speakers from the original RTTM files
      then saves the two-speaker subset of RTTM to `output_dir`.
  
      Args:
          audio_rttm_map (dict):
              A dictionary with keys of uniq id, which is being used to map audio files and corresponding rttm files
          input_manifest_path (str):
              Path of the input manifest file.
          output_dir (str):
              Path to the directory where the new RTTM files are saved.
      """
      input_manifest_dict = get_input_manifest_dict(input_manifest_path)
      rttmlist = []
      rttm_split_manifest_dict = {}
      split_audio_rttm_map = {}
      logging.info("Creating split RTTM files.")
      for uniq_id, line in tqdm(
          input_manifest_dict.items(), total=len(input_manifest_dict)
      ):
          audiopath = line["audio_filepath"]
          num_speakers = line["num_speakers"]
          rttm_filepath = line["rttm_filepath"]
  
          rttm = rttm_to_labels(rttm_filepath)
          speakers = []
          j = 0
          while len(speakers) < num_speakers:
              if rttm[j].split(" ")[2] not in speakers:
                  speakers.append(rttm[j].split(" ")[2])
              j += 1
          base_fn = audiopath.split("/")[-1].replace(".wav", "")
          for pair in itertools.combinations(speakers, 2):
              i, target_rttm = 0, []
              while i < len(rttm):
                  entry = rttm[i]
                  sp_id = entry.split(" ")[2]
                  if sp_id in pair:
                      target_rttm.append(entry)
                  i += 1
  
              pair_string = f".{pair[0]}_{pair[1]}"
              uniq_id_pair = uniq_id + pair_string
              filename = base_fn + pair_string
              labels_to_rttmfile(
                  target_rttm, base_fn, filename, output_dir
              )
              rttm_path = output_dir + filename + ".rttm"
              rttmlist.append(rttm_path)
              line_mod = copy.deepcopy(line)
              line_mod["rttm_filepath"] = rttm_path
              meta = copy.deepcopy(audio_rttm_map[uniq_id])
              meta["rttm_filepath"] = rttm_path
              rttm_split_manifest_dict[uniq_id_pair] = line_mod
              split_audio_rttm_map[uniq_id_pair] = meta
  
      return rttm_split_manifest_dict, split_audio_rttm_map
  
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 2 for calling a global function with example usage: split_into_pairwise_rttm(audio_rttm_map, input_manifest_path, output_dir) and returns: rttm_split_manifest_dict,  split_audio_rttm_map