code: def dev_nn_tuner(full_meta, split_type):
      """Tuning n_neighbors on dev set. Assuming oracle num of speakers.
      This is used when nn based affinity is selected.
      """
  
      DER_list = []
      pval = None
  
      # Now assumming oracle num of speakers.
      n_lambdas = 4
  
      for nn in range(5, 15):
          # Process whole dataset for value of n_lambdas.
          concate_rttm_file = diarize_dataset(
              full_meta, split_type, n_lambdas, pval, nn
          )
  
          ref_rttm = os.path.join(
              params["ref_rttm_dir"], "fullref_ami_dev.rttm"
          )
          sys_rttm = concate_rttm_file
          [MS, FA, SER, DER_] = DER(
              ref_rttm,
              sys_rttm,
              params["ignore_overlap"],
              params["forgiveness_collar"],
          )
  
          DER_list.append([nn, DER_])
  
          if (
              params["oracle_n_spkrs"] is True
              and params["backend"] == "kmeans"
          ):
              break
  
      DER_list.sort(key=lambda x: x[1])
      tunned_nn = DER_list[0]
  
      return tunned_nn[0]
  
imports: import os
  import sys
  import torch
  import logging
  import pickle
  import json
  import glob
  import shutil
  import numpy
  import speechbrain
  from tqdm.contrib import tqdm
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.distributed import run_on_main
  from speechbrain.processing.PLDA_LDA import StatObject_SB
  from speechbrain.processing import diarization
  from speechbrain.utils.DER import DER
  from speechbrain.dataio.dataio import read_audio
  from speechbrain.dataio.dataio import read_audio_multichannel
label_desc: Use image node_id 7 for calling a global function with example usage: dev_nn_tuner(full_meta, split_type) and returns: tunned_nn