code: def get_speech_labels_for_update(
      frame_start: float,
      buffer_end: float,
      vad_timestamps: torch.Tensor,
      cumulative_speech_labels: torch.Tensor,
      cursor_for_old_segments: float,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """
      Bring the new speech labels from the current buffer. Followingly:
  
      1. Concatenate the old speech labels from self.cumulative_speech_labels for the overlapped region.
          - This goes to new_speech_labels.
      2. Update the new 1 sec of speech label (speech_label_for_new_segments) to self.cumulative_speech_labels.
      3. Return the speech label from cursor_for_old_segments to buffer end.
  
      Args:
          frame_start (float):
              Start of the middle audio chunk in the audio buffer
          buffer_end (float):
              End of the audio buffer
          vad_timestamps (Tensor):
              Tensor containing VAD intervals (start and end timestamps)
          cumulative_speech_labels (torch.Tensor):
              Cumulative speech/non-speech timestamps (equivalent to VAD timestamps)
          cursor_for_old_segments (float):
              Floating point number that indicates the point where new segments should replace
              the old segments
  
      Returns:
          speech_label_for_new_segments (Tensor):
              The intervals (start and end) timestamps where the new incoming speech segments should
              be collected from
          cumulative_speech_labels (Tensor):
              Cumulative speech/non-speech timestamps (equivalent to VAD timestamps) with newly added
              speech/non-speech timestamps from the `vad_timestamps` input
      """
      update_overlap_range: List[float] = []
      if cursor_for_old_segments < frame_start:
          update_overlap_range = [
              float(cursor_for_old_segments),
              float(frame_start),
          ]
  
      # Get VAD timestamps that are in (frame_start, buffer_end) range
      vad_timestamps = tensor_to_list(vad_timestamps)
      cumulative_speech_labels = tensor_to_list(
          cumulative_speech_labels
      )
      new_incoming_speech_labels = get_sub_range_list(
          target_range=[float(frame_start), float(buffer_end)],
          source_range_list=vad_timestamps,
      )
  
      # Update the speech label by including overlapping region with the previous output
      update_overlap_speech_labels = get_sub_range_list(
          target_range=update_overlap_range,
          source_range_list=cumulative_speech_labels,
      )
  
      # Speech segments for embedding extractions
      speech_label_for_new_segments = merge_float_intervals(
          update_overlap_speech_labels + new_incoming_speech_labels,
          margin=0,
      )
  
      # Keep cumulative VAD labels for the future use
      cumulative_speech_labels = merge_float_intervals(
          cumulative_speech_labels + new_incoming_speech_labels,
          margin=0,
      )
  
      # Convert the lists back to type torch.Tensor
      speech_label_for_new_segments = torch.tensor(
          speech_label_for_new_segments
      )
      cumulative_speech_labels = torch.tensor(cumulative_speech_labels)
  
      return speech_label_for_new_segments, cumulative_speech_labels
  
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 36 for calling a global function with example usage: get_speech_labels_for_update(frame_start, buffer_end, vad_timestamps, cumulative_speech_labels, cursor_for_old_segments) and returns: speech_label_for_new_segments,  cumulative_speech_labels