code: def lazy_load(name):
      """Decorator to define a function that lazily loads the module 'name'.
  
      This can be used to defer importing troublesome dependencies - e.g. ones that
      are large and infrequently used, or that cause a dependency cycle -
      until they are actually used.
  
      Args:
        name: the fully-qualified name of the module; typically the last segment
          of 'name' matches the name of the decorated function
  
      Returns:
        Decorator function that produces a lazy-loading module 'name' backed by the
        underlying decorated function.
      """
  
      def wrapper(load_fn):
          # Wrap load_fn to call it exactly once and update __dict__ afterwards to
          # make future lookups efficient (only failed lookups call __getattr__).
          @_memoize
          def load_once(self):
              if load_once.loading:
                  raise ImportError(
                      "Circular import when resolving LazyModule %r"
                      % name
                  )
              load_once.loading = True
              try:
                  module = load_fn()
              finally:
                  load_once.loading = False
              self.__dict__.update(module.__dict__)
              load_once.loaded = True
              return module
  
          load_once.loading = False
          load_once.loaded = False
  
          # Define a module that proxies getattr() and dir() to the result of calling
          # load_once() the first time it's needed. The class is nested so we can close
          # over load_once() and avoid polluting the module's attrs with our own state.
          class LazyModule(types.ModuleType):
              def __getattr__(self, attr_name):
                  return getattr(load_once(self), attr_name)
  
              def __dir__(self):
                  return dir(load_once(self))
  
              def __repr__(self):
                  if load_once.loaded:
                      return "<%r via LazyModule (loaded)>" % load_once(
                          self
                      )
                  return (
                      "<module %r via LazyModule (not yet loaded)>"
                      % self.__name__
                  )
  
          return LazyModule(name)
  
      return wrapper
  
imports: import functools
  import threading
  import types
label_desc: Use image node_id 1 for calling a global function with example usage: lazy_load(name) and returns: wrapper, LazyModule, module, getattr, dir, unknown, unknown