code: def class_from_module_path(
      module_path: Text, lookup_path: Optional[Text] = None
  ) -> Type:
      """Given the module name and path of a class, tries to retrieve the class.
  
      The loaded class can be used to instantiate new objects.
  
      Args:
          module_path: either an absolute path to a Python class,
                       or the name of the class in the local / global scope.
          lookup_path: a path where to load the class from, if it cannot
                       be found in the local / global scope.
  
      Returns:
          a Python class
  
      Raises:
          ImportError, in case the Python class cannot be found.
          RasaException, in case the imported result is something other than a class
      """
      klass = None
      if "." in module_path:
          module_name, _, class_name = module_path.rpartition(".")
          m = importlib.import_module(module_name)
          klass = getattr(m, class_name, None)
      elif lookup_path:
          # try to import the class from the lookup path
          m = importlib.import_module(lookup_path)
          klass = getattr(m, module_path, None)
  
      if klass is None:
          raise ImportError(
              f"Cannot retrieve class from path {module_path}."
          )
  
      if not inspect.isclass(klass):
          raise RasaException(
              f"`class_from_module_path()` is expected to return a class, "
              f"but for {module_path} we got a {type(klass)}."
          )
      return klass
  
imports: import asyncio
  import functools
  import importlib
  import inspect
  import logging
  from typing import Text, Dict, Optional, Any, List, Callable, Collection, Type
  from rasa.shared.exceptions import RasaException
label_desc: Use image node_id 1 for calling a global function with example usage: class_from_module_path(module_path, lookup_path) and returns: klass