code: def set_noise_pairs(
      pairs, noise_pairs, aishell1_md_file, wham_md_file
  ):
      print("Generating pairs")
      # Initially take not augmented data
      md = wham_md_file[wham_md_file["augmented"] == "False"]
      # If there are more mixtures than noises then use augmented data
      if len(pairs) > len(md):
          md = wham_md_file
      # Copy pairs because we are going to remove elements from pairs
      for pair in pairs.copy():
          # get sources infos
          sources = [
              aishell1_md_file.iloc[pair[i]] for i in range(len(pair))
          ]
          # get max_length
          length_list = [source["length"] for source in sources]
          max_length = max(length_list)
          # Ideal choices are noises longer than max_length
          possible = md[md["length"] >= max_length]
          # if possible is not empty
          try:
              # random noise longer than max_length
              pair_noise = random.sample(list(possible.index), 1)
              # add that noise's index to the list
              noise_pairs.append(pair_noise)
              # remove that noise from the remaining noises
              md = md.drop(pair_noise)
          # if possible is empty
          except ValueError:
              # take the longest noise remaining
              pair_noise = list(md.index)[-1]
              # add it to noise list
              noise_pairs.append(pair_noise)
              # remove it from remaining noises
              md = md.drop(pair_noise)
  
      return noise_pairs
  
imports: import argparse
  import os
  import random
  import warnings
  import numpy
  import pandas
  import pyloudnorm
  import soundfile
  from tqdm import tqdm
label_desc: Use image node_id 7 for calling a global function with example usage: set_noise_pairs(pairs, noise_pairs, aishell1_md_file, wham_md_file) and returns: noise_pairs