code: def find_classes(directory: str) -> Tuple[List[str], Dict[str, int]]:
      """Finds the class folders in a dataset.
  
      See :class:`DatasetFolder` for details.
      """
      classes = sorted(
          entry.name
          for entry in os.scandir(directory)
          if entry.is_dir()
      )
      if not classes:
          raise FileNotFoundError(
              f"Couldn't find any class folder in {directory}."
          )
  
      class_to_idx = {cls_name: i for i, cls_name in enumerate(classes)}
      return classes, class_to_idx
  
imports: import os
  import os.path
  from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union
  from PIL import Image
  from .vision import VisionDataset
label_desc: Use image node_id 3 for calling a global function with example usage: find_classes(directory) and returns: classes,  class_to_idx