code: def _get_filename_by_index(dataset, index):
      """Default function which maps the index of an image to a filename."""
      if isinstance(dataset, datasets.ImageFolder):
          # filename is the path of the image relative to the dataset root
          full_path = dataset.imgs[index][0]
          return os.path.relpath(full_path, dataset.root)
      elif isinstance(dataset, DatasetFolder):
          # filename is the path of the image relative to the dataset root
          full_path = dataset.samples[index][0]
          return os.path.relpath(full_path, dataset.root)
      elif isinstance(dataset, VideoDataset):
          # filename is constructed by the video dataset
          return dataset.get_filename(index)
      else:
          # dummy to prevent crashes
          return str(index)
  
imports: import bisect
  import os
  import shutil
  import tempfile
  from typing import Any, Callable, Dict, List, Union
  import torchvision.datasets
  from PIL import Image
  from torchvision import transforms
  from torchvision.datasets.vision import StandardTransform, VisionDataset
  from lightly.data._helpers import DatasetFolder, _load_dataset_from_folder
  from lightly.data._video import VideoDataset
label_desc: Use image node_id 1 for calling a global function with example usage: _get_filename_by_index(dataset, index) and returns: os, os, dataset, str