code: def verify_label_lengths(
      audio_sizes,
      audio_rate,
      label_path,
      label_rate,
      inds,
      tot,
      tol=0.1,  # tolerance in seconds
  ):
      if label_rate < 0:
          logger.info(f"{label_path} is sequence label. skipped")
          return
  
      with open(label_path) as f:
          lengths = [len(line.rstrip().split()) for line in f]
          assert len(lengths) == tot
          lengths = [lengths[i] for i in inds]
      num_invalid = 0
      for i, ind in enumerate(inds):
          dur_from_audio = audio_sizes[i] / audio_rate
          dur_from_label = lengths[i] / label_rate
          if abs(dur_from_audio - dur_from_label) > tol:
              logger.warning(
                  (
                      f"audio and label duration differ too much "
                      f"(|{dur_from_audio} - {dur_from_label}| > {tol}) "
                      f"in line {ind+1} of {label_path}. Check if `label_rate` "
                      f"is correctly set (currently {label_rate}). "
                      f"num. of samples = {audio_sizes[i]}; "
                      f"label length = {lengths[i]}"
                  )
              )
              num_invalid += 1
      if num_invalid > 0:
          logger.warning(
              f"total {num_invalid} (audio, label) pairs with mismatched lengths"
          )
  
imports: import itertools
  import logging
  import os
  import sys
  from typing import Any, List, Optional, Union
  import numpy
  import torch
  import torch.nn.functional
  from fairseq.data import data_utils
  from fairseq.data.fairseq_dataset import FairseqDataset
  from fairseq.data.audio.audio_utils import parse_path, read_from_stored_zip
  import io
label_desc: Use image node_id 4 for calling a global function with example usage: verify_label_lengths(audio_sizes, audio_rate, label_path, label_rate, inds, tot, tol) without return types