code: def import_type(
      module_name: str,
      type_name: str,
      base: t.Optional[t.Type[t.Any]] = None,
  ) -> t.Type[t.Any]:
      """Import and return type instance by name."""
      module = importlib.import_module(module_name)
      type_ = getattr(module, type_name, None)
  
      if not isinstance(type_, type):
          name = type(type_).__qualname__  # type: ignore
          raise TypeError(
              f"Expected to import type instance, instead get - {name}"
          )
  
      if base is not None and not issubclass(type_, base):
          name = type(type_).__qualname__  # type: ignore
          bname = type(base).__qualname__
          raise TypeError(
              f'Expected to import a subtype of "{bname}", instead got - {name}'
          )
  
      return type_
  
file_path: deepchecks/deepchecks/core/common.py
imports: import importlib
  import typing
  from typing_extensions import Literal
  from deepchecks import __version__
  from deepchecks.utils.logger import get_logger
label_desc: Use image node_id 2 for calling a global function with example usage: import_type(module_name, type_name, base) and returns: type_