code: def import_class_from_module(
      class_name: str, module_path: str
  ) -> Any:
      module_dir = pathlib.Path(os.path.dirname(module_path))
  
      with det.import_from_path(module_dir):
          spec = importlib.util.spec_from_file_location(
              class_name, module_path
          )
          module = importlib.util.module_from_spec(spec)  # type: ignore
          spec.loader.exec_module(module)  # type: ignore
          trial_cls = getattr(module, class_name)  # noqa: B009
  
      return trial_cls
  
imports: import importlib
  import os
  import pathlib
  import re
  import unittest.mock
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type
  import numpy
  import pytest
  from mypy_extensions import DefaultNamedArg
  import determined
  from determined import core, gpu, workload
  from determined.common import util
label_desc: Use image node_id 8 for calling a global function with example usage: import_class_from_module(class_name, module_path) and returns: trial_cls