code: def add_t_start_end_to_utt_obj(
      utt_obj, alignment_utt, output_timestep_duration
  ):
      """
      Function to add t_start and t_end (representing time in seconds) to the Utterance object utt_obj.
      Args:
          utt_obj: Utterance object to which we will add t_start and t_end for its
              constituent segments/words/tokens.
          alignment_utt: a list of ints indicating which token does the alignment pass through at each
              timestep (will take the form [0, 0, 1, 1, ..., <num of tokens including blanks in uterance>]).
          output_timestep_duration: a float indicating the duration of a single output timestep from
              the ASR Model.
  
      Returns:
          utt_obj: updated Utterance object.
      """
  
      # General idea for the algorithm of how we add t_start and t_end
      # the timestep where a token s starts is the location of the first appearance of s_start in alignment_utt
      # the timestep where a token s ends is the location of the final appearance of s_end in alignment_utt
      # We will make dictionaries num_to_first_alignment_appearance and
      # num_to_last_appearance and use that to update all of
      # the t_start and t_end values in utt_obj.
      # We will put t_start = t_end = -1 for tokens that are skipped (should only be blanks)
  
      num_to_first_alignment_appearance = dict()
      num_to_last_alignment_appearance = dict()
  
      prev_s = -1  # use prev_s to keep track of when the s changes
      for t, s in enumerate(alignment_utt):
          if s > prev_s:
              num_to_first_alignment_appearance[s] = t
  
              if prev_s >= 0:  # dont record prev_s = -1
                  num_to_last_alignment_appearance[prev_s] = t - 1
          prev_s = s
      # add last appearance of the final s
      num_to_last_alignment_appearance[prev_s] = len(alignment_utt) - 1
  
      # update all the t_start and t_end in utt_obj
      for segment_or_token in utt_obj.segments_and_tokens:
          if type(segment_or_token) is Segment:
              segment = segment_or_token
              segment.t_start = (
                  num_to_first_alignment_appearance[segment.s_start]
                  * output_timestep_duration
              )
              segment.t_end = (
                  num_to_last_alignment_appearance[segment.s_end] + 1
              ) * output_timestep_duration
  
              for word_or_token in segment.words_and_tokens:
                  if type(word_or_token) is Word:
                      word = word_or_token
                      word.t_start = (
                          num_to_first_alignment_appearance[
                              word.s_start
                          ]
                          * output_timestep_duration
                      )
                      word.t_end = (
                          num_to_last_alignment_appearance[word.s_end]
                          + 1
                      ) * output_timestep_duration
  
                      for token in word.tokens:
                          if (
                              token.s_start
                              in num_to_first_alignment_appearance
                          ):
                              token.t_start = (
                                  num_to_first_alignment_appearance[
                                      token.s_start
                                  ]
                                  * output_timestep_duration
                              )
                          else:
                              token.t_start = -1
  
                          if (
                              token.s_end
                              in num_to_last_alignment_appearance
                          ):
                              token.t_end = (
                                  num_to_last_alignment_appearance[
                                      token.s_end
                                  ]
                                  + 1
                              ) * output_timestep_duration
                          else:
                              token.t_end = -1
                  else:
                      token = word_or_token
                      if (
                          token.s_start
                          in num_to_first_alignment_appearance
                      ):
                          token.t_start = (
                              num_to_first_alignment_appearance[
                                  token.s_start
                              ]
                              * output_timestep_duration
                          )
                      else:
                          token.t_start = -1
  
                      if (
                          token.s_end
                          in num_to_last_alignment_appearance
                      ):
                          token.t_end = (
                              num_to_last_alignment_appearance[
                                  token.s_end
                              ]
                              + 1
                          ) * output_timestep_duration
                      else:
                          token.t_end = -1
  
          else:
              token = segment_or_token
              if token.s_start in num_to_first_alignment_appearance:
                  token.t_start = (
                      num_to_first_alignment_appearance[token.s_start]
                      * output_timestep_duration
                  )
              else:
                  token.t_start = -1
  
              if token.s_end in num_to_last_alignment_appearance:
                  token.t_end = (
                      num_to_last_alignment_appearance[token.s_end] + 1
                  ) * output_timestep_duration
              else:
                  token.t_end = -1
  
      return utt_obj
  
imports: import json
  from dataclasses import dataclass, field
  from pathlib import Path
  from typing import List, Union
  import soundfile
  import torch
  from tqdm.auto import tqdm
  from utils.constants import BLANK_TOKEN, SPACE_TOKEN, V_NEGATIVE_NUM
  from nemo.utils import logging
label_desc: Use image node_id 10 for calling a global function with example usage: add_t_start_end_to_utt_obj(utt_obj, alignment_utt, output_timestep_duration) and returns: utt_obj