code: def _dump_image(dataset, output_dir, filename, index, fmt):
      """Saves a single image to the output directory.
  
      Will copy the image from the input directory to the output directory
      if possible. If not (e.g. for VideoDatasets), will load the image and
      then save it to the output directory with the specified format.
  
      """
  
      if isinstance(dataset, datasets.ImageFolder):
          # can safely copy the image from the input to the output directory
          _copy_image(dataset.root, output_dir, filename)
      elif isinstance(dataset, DatasetFolder):
          # can safely copy the image from the input to the output directory
          _copy_image(dataset.root, output_dir, filename)
      else:
          # need to load the image and save it to the output directory
          image, _ = dataset[index]
          _save_image(image, output_dir, filename, fmt)
  
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 5 for calling a global function with example usage: _dump_image(dataset, output_dir, filename, index, fmt) without return types