code: def _resolve_path(
      folder: str | Path, root: str | Path | None = None
  ) -> Path:
      """Combines root and folder and returns the absolute path.
  
      This allows users to pass either a root directory and relative paths, or absolute paths to each of the
      image sources. This function makes sure that the samples dataframe always contains absolute paths.
  
      Args:
          folder (str | Path | None): Folder location containing image or mask data.
          root (str | Path | None): Root directory for the dataset.
      """
      folder = Path(folder)
      if folder.is_absolute():
          # path is absolute; return unmodified
          path = folder
      # path is relative.
      elif root is None:
          # no root provided; return absolute path
          path = folder.resolve()
      else:
          # root provided; prepend root and return absolute path
          path = (Path(root) / folder).resolve()
      return path
  
file_path: anomalib/src/anomalib/data/utils/path.py
imports: from __future__ import annotations
  from enum import Enum
  from pathlib import Path
  from torchvision.datasets.folder import IMG_EXTENSIONS
label_desc: Use image node_id 3 for calling a global function with example usage: _resolve_path(folder, root) and returns: path