code: def get_new_cursor_for_update(
      frame_start: float,
      segment_range_ts: List[List[float]],
  ) -> Tuple[float, int]:
      """
      Function for updating a cursor online speaker diarization.
      Remove the old segments that overlap with the new frame (self.frame_start)
      cursor_for_old_segments is set to the onset of the t_range popped lastly.
  
  
      Args:
          frame_start (float):
              Start of streaming pipeline frame
          segment_range_ts (float):
              Interval (start and end timestamps) of the targeted segments
  
      Returns:
          cursor_for_old_segments (float):
              Floating point number that indicates the point where new segments should replace
              the old segments
          cursor_index (int):
              The index of the first newly accepted segments
      """
      cursor_for_old_segments = frame_start
      cursor_index: int = len(segment_range_ts)
      count = 0
      while True and len(segment_range_ts) > 0:
          t_range = segment_range_ts[-1 * (count + 1)]
          if frame_start <= t_range[1]:
              count += 1
              cursor_for_old_segments = t_range[0]
          else:
              break
      cursor_index = len(segment_range_ts) - count
      return cursor_for_old_segments, cursor_index
  
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 37 for calling a global function with example usage: get_new_cursor_for_update(frame_start, segment_range_ts) and returns: cursor_for_old_segments,  cursor_index