code: def _read_video_paths_and_labels(
      label_name_file: str,
      video_label_file: str,
      video_path_label_file: str,
      prefix: str = "",
  ) -> Tuple[List[str], List[int]]:
      """
      Args:
          label_name_file (str): ssv2 label file that contians the label names and
              indexes. ('/path/to/folder/something-something-v2-labels.json')
          video_label_file (str): a file that contains video ids and the corresponding
              video label. (e.g., '/path/to/folder/something-something-v2-train.json')
          video_path_label_file (str): a file that contains frame paths for each
              video and the corresponding frame label. The file must be a space separated
              csv of the format:
                  `original_vido_id video_id frame_id path labels`
          prefix (str): prefix path to add to all paths from video_path_label_file.
  
      Returns:
          image_paths (list): list of list containing path to each frame.
          labels (list): list containing label of each video.
      """
      # Loading image paths.
      paths = defaultdict(list)
      with g_pathmgr.open(video_path_label_file, "r") as f:
          # Space separated CSV with format: original_vido_id video_id frame_id path labels
          csv_reader = csv.DictReader(f, delimiter=" ")
          for row in csv_reader:
              assert len(row) == 5
              video_name = row["original_vido_id"]
              path = os.path.join(prefix, row["path"])
              paths[video_name].append(path)
  
      # Loading label names.
      with g_pathmgr.open(label_name_file, "r") as f:
          label_name_dict = json.load(f)
  
      with g_pathmgr.open(video_label_file, "r") as f:
          video_label_json = json.load(f)
  
      labels = []
      image_paths = []
      for video in video_label_json:
          video_name = video["id"]
          if video_name in paths:
              template = video["template"]
              template = template.replace("[", "")
              template = template.replace("]", "")
              label = int(label_name_dict[template])
              image_paths.append(paths[video_name])
              labels.append(label)
  
      return image_paths, labels
  
imports: import csv
  import functools
  import json
  import os
  import random
  from collections import defaultdict
  from typing import Any, Callable, List, Optional, Tuple, Type
  import numpy
  import torch
  import torch.utils.data
  from iopath.common.file_io import g_pathmgr
  from pytorchvideo.data.clip_sampling import ClipSampler
  from pytorchvideo.data.frame_video import FrameVideo
  from .utils import MultiProcessSampler
label_desc: Use image node_id 1 for calling a global function with example usage: _read_video_paths_and_labels(label_name_file, video_label_file, video_path_label_file, prefix) and returns: image_paths,  labels