code: def parse_scale_configs(
      window_lengths_in_sec, shift_lengths_in_sec, multiscale_weights
  ):
      """
      Check whether multiscale parameters are provided correctly. window_lengths_in_sec, shift_lengfhs_in_sec and
      multiscale_weights should be all provided in omegaconf.listconfig.ListConfig type. In addition, the scales
      should be provided in descending order, from the longest scale to the base scale (the shortest).
  
      Example:
          Single-scale setting:
              parameters.window_length_in_sec=1.5
              parameters.shift_length_in_sec=0.75
              parameters.multiscale_weights=null
  
          Multiscale setting (base scale - window_length 0.5 s and shift_length 0.25):
              parameters.window_length_in_sec=[1.5,1.0,0.5]
              parameters.shift_length_in_sec=[0.75,0.5,0.25]
              parameters.multiscale_weights=[1,1,1]
  
      In addition, you can also specify session-by-session multiscale weight. In this case, each dictionary key
      points to different weights.
      """
      check_float_config = [
          isinstance(var, float)
          for var in (window_lengths_in_sec, shift_lengths_in_sec)
      ]
      check_list_config = [
          isinstance(
              var, (omegaconf.listconfig.ListConfig, list, tuple)
          )
          for var in (
              window_lengths_in_sec,
              shift_lengths_in_sec,
              multiscale_weights,
          )
      ]
      if all(check_list_config) or all(check_float_config):
          # If bare floating numbers are provided, convert them to list format.
          if all(check_float_config):
              window_lengths, shift_lengths, multiscale_weights = (
                  [window_lengths_in_sec],
                  [shift_lengths_in_sec],
                  [1.0],
              )
          else:
              window_lengths, shift_lengths, multiscale_weights = (
                  window_lengths_in_sec,
                  shift_lengths_in_sec,
                  multiscale_weights,
              )
  
          length_check = (
              len(
                  set(
                      [
                          len(window_lengths),
                          len(shift_lengths),
                          len(multiscale_weights),
                      ]
                  )
              )
              == 1
              and len(multiscale_weights) > 0
          )
          scale_order_check = (
              list(window_lengths) == sorted(window_lengths)[::-1]
              and list(shift_lengths) == sorted(shift_lengths)[::-1]
          )
  
          # Check whether window lengths are longer than shift lengths
          if len(window_lengths) > 1:
              shift_length_check = all(
                  [w > s for w, s in zip(window_lengths, shift_lengths)]
              )
          else:
              shift_length_check = window_lengths[0] > shift_lengths[0]
  
          multiscale_args_dict = {"use_single_scale_clustering": False}
          if all([length_check, scale_order_check, shift_length_check]):
              if len(window_lengths) > 1:
                  multiscale_args_dict["scale_dict"] = {
                      k: (w, s)
                      for k, (w, s) in enumerate(
                          zip(window_lengths, shift_lengths)
                      )
                  }
              else:
                  multiscale_args_dict["scale_dict"] = {
                      0: (window_lengths[0], shift_lengths[0])
                  }
              multiscale_args_dict[
                  "multiscale_weights"
              ] = multiscale_weights
              return multiscale_args_dict
          else:
              raise ValueError(
                  "Multiscale parameters are not properly setup."
              )
  
      elif any(check_list_config):
          raise ValueError(
              "You must provide a list config for all three parameters: window, shift and multiscale weights."
          )
      else:
          return None
  
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 5 for calling a global function with example usage: parse_scale_configs(window_lengths_in_sec, shift_lengths_in_sec, multiscale_weights) and returns: multiscale_args_dict, None