code: def resolve_path(path: Path | str, base_path: Path) -> str:
      assert path is not None
      # Path.resolve() does not work on Windows when file not exist, so use os.path instead
      path = os.path.expanduser(path)
      if not os.path.isabs(path):
          path = os.path.join(base_path, path)
      return str(os.path.realpath(path))
  
imports: from __future__ import annotations
  import copy
  import dataclasses
  import importlib
  import json
  import os.path
  from pathlib import Path
  import socket
  from typing import TYPE_CHECKING, get_type_hints
  import typeguard
  import nni.runtime.config
  from .public import is_missing
label_desc: Use image node_id 4 for calling a global function with example usage: resolve_path(path, base_path) and returns: str