code: def check_window_len(
      s_time: float, e_time: float, w_len: float, video_dur: float
  ) -> Tuple[float, float]:
      """
      Constrain/slide the give time window to `w_len` size and the video/clip length.
      """
      # adjust to match w_len
      interval = e_time - s_time
      if abs(interval - w_len) > 0.001:
          # TODO: Do we want to sample rather than trim the interior when larger?
          delta = w_len - (e_time - s_time)
          s_time = s_time - (delta / 2)
          e_time = e_time + (delta / 2)
          if s_time < 0:
              e_time += -s_time
              s_time = 0
      if video_dur:
          if e_time > video_dur:
              overlap = e_time - video_dur
              assert s_time >= overlap, "Incompatible w_len / video_dur"
              s_time -= overlap
              e_time -= overlap
              log.info(
                  f"check_window_len: video overlap ({overlap}) adjusted -> ({s_time:.2f}, {e_time:.2f}) video: {video_dur}"  # noqa
              )
      if abs((e_time - s_time) - w_len) > 0.01:
          log.error(
              f"check_window_len: invalid time interval: {s_time}, {e_time}",
              stack_info=True,
          )
      return s_time, e_time
  
file_path: pytorchvideo/pytorchvideo/data/ego4d/utils.py
imports: import json
  import logging
  from abc import ABC, abstractmethod
  from typing import Any, Dict, Tuple
  from iopath.common.file_io import g_pathmgr
  from pytorchvideo.data.clip_sampling import ClipInfo, ClipSampler
  from pytorchvideo.data.utils import get_logger
label_desc: Use image node_id 1 for calling a global function with example usage: check_window_len(s_time, e_time, w_len, video_dur) and returns: s_time,  e_time