code: def map_timestamps_to_new_sr(
      vad_sr, new_sr, timestamps, just_begging_end=False
  ):
      factor = new_sr / vad_sr
      new_timestamps = []
      if just_begging_end and timestamps:
          # get just the start and end timestamps
          new_dict = {
              "start": int(timestamps[0]["start"] * factor),
              "end": int(timestamps[-1]["end"] * factor),
          }
          new_timestamps.append(new_dict)
      else:
          for ts in timestamps:
              # map to the new SR
              new_dict = {
                  "start": int(ts["start"] * factor),
                  "end": int(ts["end"] * factor),
              }
              new_timestamps.append(new_dict)
  
      return new_timestamps
  
imports: import torch
  import torchaudio
label_desc: Use image node_id 3 for calling a global function with example usage: map_timestamps_to_new_sr(vad_sr, new_sr, timestamps, just_begging_end) and returns: new_timestamps