code: def alias_submodules(
      module, tl_package, extension_point, extra_indent=False
  ):
      if extra_indent:
          extra_indent = "    "
      else:
          extra_indent = ""
      lazy_load_custom_modules = {}
  
      _ext_debug(
          "%sAliasing submodules for '%s'"
          % (extra_indent, module.__name__)
      )
  
      addl_modules = module.__dict__.get("__mf_promote_submodules__")
      if addl_modules:
          # We make an alias for these modules which the extension author wants to
          # expose but since it may not already be loaded, we don't load it either
  
          # TODO: This does not properly work for multiple packages that overwrite
          # their submodule for example if EXT_PKG.X.datatools.Y is provided
          # by two packages. For now, don't do this.
          if extension_point is not None:
              lazy_load_custom_modules.update(
                  {
                      "metaflow.%s.%s"
                      % (extension_point, k): "%s.%s.%s.%s"
                      % (EXT_PKG, tl_package, extension_point, k)
                      for k in addl_modules
                  }
              )
          else:
              # Top-level "metaflow" overrides
              lazy_load_custom_modules.update(
                  {
                      "metaflow.%s"
                      % k: "%s.%s.%s"
                      % (EXT_PKG, tl_package, k)
                      for k in addl_modules
                  }
              )
          if lazy_load_custom_modules:
              _ext_debug(
                  "%s    Found explicit promotions in __mf_promote_submodules__: %s"
                  % (
                      extra_indent,
                      str(list(lazy_load_custom_modules.keys())),
                  )
              )
      for n, o in module.__dict__.items():
          if (
              isinstance(o, types.ModuleType)
              and o.__package__
              and o.__package__.startswith(
                  "%s.%s" % (EXT_PKG, tl_package)
              )
          ):
              # NOTE: The condition above prohibits loading across tl_packages. We
              # can relax if needed but may not be a great idea.
              if extension_point is not None:
                  lazy_load_custom_modules[
                      "metaflow.%s.%s" % (extension_point, n)
                  ] = o
              else:
                  lazy_load_custom_modules["metaflow.%s" % n] = o
      _ext_debug(
          "%s    Will create the following module aliases: %s"
          % (extra_indent, str(list(lazy_load_custom_modules.keys())))
      )
      _aliased_modules.extend(lazy_load_custom_modules.keys())
      return lazy_load_custom_modules
  
imports: from __future__ import print_function
  import importlib
  import json
  import os
  import re
  import sys
  import types
  from collections import defaultdict, namedtuple
  from importlib.abc import MetaPathFinder, Loader
  from itertools import chain
label_desc: Use image node_id 8 for calling a global function with example usage: alias_submodules(module, tl_package, extension_point, extra_indent) and returns: lazy_load_custom_modules