code: def recognize_data_format(data) -> str:
      """Checks the data format and returns "pytorch-dataset" or "numpy" or "files"."""
  
      # Check for pytorch dataset.
      if isinstance(data, Dataset):
          return "pytorch-dataset"
  
      # Check for iterable of numpy arrays (images, labels).
      try:
          if (
              len(data) == 2
              and isinstance(data[0], np.ndarray)
              and isinstance(data[1], np.ndarray)
          ):
              # Check for correct shape of images.
              images, labels = data
              if len(images.shape) == 4 and (images.shape[1] in [1, 3]):
                  return "numpy"
              else:
                  raise ValueError(
                      "Shape of images not understood, should be "
                      "num_samples x color_channels (1 or 3) x height x width, "
                      f"is: {images.shape}"
                  )
      except TypeError:  # data is no iterable
          pass
  
      # Check for path to directory.
      try:
          if Path(data).exists():
              return "files"
          else:
              raise FileNotFoundError(
                  f"Data directory does not exist: {data}"
              )
      except TypeError:  # not a file or dir
          pass
  
      # If all checks failed...
      raise ValueError(
          "Data format not recognized. Supported formats: list of numpy "
          "arrays, torch dataset, directory of image files"
      )
  
imports: import numpy
  import torch
  from torch.utils.data import Dataset
  from torchvision import datasets, transforms
  from typing import List, Union
  from pathlib import Path
  from PIL import Image
label_desc: Use image node_id 3 for calling a global function with example usage: recognize_data_format(data) and returns: str, str, str