code: def fetch_labels_from_timestamps(
      class_label_name: str,
      timestamps: List[float],
      rectangles_dict: Dict[str, List[Dict[str, Any]]],
      interpolation_cutoff_threshold_sec: Optional[float] = None,
      progressible_labels: Optional[Collection[int]] = None,
      carry_over_keys: Optional[List[str]] = None,
      required_keys: Optional[List[str]] = None,
  ) -> Dict[str, List[Dict[str, Any]]]:
      """Returns object labels for the specified video frame timestamps.
  
      The result will retain the structure of `rectangles_dict`, but just ensure that the
      timestamp values are as requested.
  
      If `progressible_labels` are supplied, the `"progress"` field will be included. This
      field represents the 'normalized' amount of time that the class label has existed
      temporally. See
      tests/data/datasets/utils/test_video.py:test_fetch_frame_with_progress for examples.
  
      This fetching function can be used for (per-frame) video classification pipelines.
  
      Args:
          class_label_name: The field name in `rectangles_dict` that maps to the class
              label.
          timestamps: A list of timestamps to fectch label from.
          rectangles_dict: (See docstring at top of file.)
          interpolation_cutoff_threshold_sec: Threshold under which we allow
              interpolation. In some `rectangles_dict`s, the labels (within the same
              track) are so far apart (e.g. 10 seconds) that interpolation is
              non-sensical. Thus this value prevents unrelated labels from being
              interpolated.
          progressible_labels: Set of labels for which to calculate `"progress"` for the
              resulting bounding boxes. If None, no `"progress"` field will be included.
          carry_over_keys: A list of keywords that specifies which keys should be carried
              over from the previous rectangle during interpolation. Defaults to None.
          required_keys: A list of keywords that specifies which keywords need to be
              included in a new bounding_box in addition to the @class_label_name.
              Defaults to None.
  
      Returns:
          Dict containing the labels, still indexable by track id.
      """
  
      if (
          progressible_labels is not None
          and len(progressible_labels) > 1
      ):
          raise NotImplementedError(
              "Currently only the calculation of one progressible label is supported;"
              f" got labels={progressible_labels}."
          )
  
      labels = []
      for timestamp in timestamps:
          labels.append(
              _fetch_frame_label(
                  class_label_name,
                  timestamp,
                  rectangles_dict,
                  interpolation_cutoff_threshold_sec,
                  progressible_labels,
                  carry_over_keys,
                  required_keys,
              )
          )
  
      # Reslice @labels to be a dict of lists.
      ret = {}
      for label in labels:
          # @label is a dict with a key and dict of values.
          for k, v in label.items():
              if k not in ret:
                  ret[k] = []
              ret[k].append(v)
  
      return ret
  
file_path: ml-cvnets/data/datasets/utils/video.py
imports: import functools
  from typing import Any, Collection, Dict, List, Optional, Tuple
  import numpy
  from utils import logger
label_desc: Use image node_id 3 for calling a global function with example usage: fetch_labels_from_timestamps(class_label_name, timestamps, rectangles_dict, interpolation_cutoff_threshold_sec, progressible_labels, carry_over_keys, required_keys) and returns: ret