code: def _compute_path(base_dir, element, check_path=False):
      """
      Args:
          base_dir: the base directory of the dataset.
          element: file path(s) to append to directory.
          check_path: if `True`, only compute when the result is an existing path.
  
      Raises:
          TypeError: When ``element`` contains a non ``str``.
          TypeError: When ``element`` type is not in ``Union[list, str]``.
  
      """
  
      def _join_path(base_dir: PathLike, item: PathLike):
          result = os.path.normpath(os.path.join(base_dir, item))
          if check_path and not os.path.exists(result):
              # if not an existing path, don't join with base dir
              return f"{item}"
          return f"{result}"
  
      if isinstance(element, (str, os.PathLike)):
          return _join_path(base_dir, element)
      if isinstance(element, list):
          for e in element:
              if not isinstance(e, (str, os.PathLike)):
                  return element
          return [_join_path(base_dir, e) for e in element]
      return element
  
file_path: MONAI/monai/data/decathlon_datalist.py
imports: from __future__ import annotations
  import json
  import os
  import warnings
  from collections.abc import Sequence
  from pathlib import Path
  from typing import overload
  from monai.config import KeysCollection, PathLike
  from monai.data.utils import partition_dataset, select_cross_validation_folds
  from monai.utils import ensure_tuple
label_desc: Use image node_id 3 for calling a global function with example usage: _compute_path(base_dir, element, check_path) and returns: element, result, _join_path, unknown, item, element