code: def generate_trampolines(out_dir):
      # This function will look in the configurations directory and create
      # files named <module>.py that will properly setup the environment escape when
      # called
  
      # in some cases we may want to disable environment escape
      # functionality, in that case, set METAFLOW_ENV_ESCAPE_DISABLED
      if os.environ.get("METAFLOW_ENV_ESCAPE_DISABLED", False) in (
          True,
          "True",
      ):
          return
  
      paths = [
          os.path.join(
              os.path.dirname(os.path.abspath(__file__)),
              "configurations",
          )
      ]
      paths.extend(
          [
              os.path.join(
                  os.path.dirname(m.module.__file__), "configurations"
              )
              for m in get_modules("plugins.env_escape")
          ]
      )
  
      for rootpath in paths:
          for path in os.listdir(rootpath):
              path = os.path.join(rootpath, path)
              if os.path.isdir(path):
                  dir_name = os.path.basename(path)
                  if dir_name.startswith("emulate_"):
                      module_names = dir_name[8:].split("__")
                      for module_name in module_names:
                          with open(
                              os.path.join(
                                  out_dir, module_name + ".py"
                              ),
                              mode="w",
                              encoding="utf-8",
                          ) as f:
                              f.write(
                                  """
  import importlib
  import os
  import sys
  from metaflow.plugins.env_escape.client_modules import ModuleImporter
  
  # This is a trampoline file to ensure that the ModuleImporter to handle the emulated
  # modules gets properly loaded. If multiple modules are emulated by a single configuration
  # the first import will cause this trampoline file to be loaded. All other calls will use
  # the module importer since we insert the importer at the head of the meta_path
  
  def load():
      # We check if we are not overriding a module that already exists; to do so, we remove
      # the path we live at from sys.path and check
      old_paths = sys.path
      cur_path = os.path.dirname(__file__)
      sys.path = [p for p in old_paths if p != cur_path]
      # Handle special case where we launch a shell (including with a command)
      # and we are in the CWD (searched if '' is the first element of sys.path)
      if cur_path == os.getcwd() and sys.path[0] == '':
          sys.path = sys.path[1:]
  
      # Remove the module (this file) to reload it properly. Do *NOT* update sys.modules but
      # modify directly since it may be referenced elsewhere
      del sys.modules["{module_name}"]
  
      for prefix in {prefixes}:
          try:
              importlib.import_module(prefix)
          except ImportError:
              # Here we actually have two cases: we are being imported from the client (inner env)
              # in which case we are happy (since no module exists) OR we are being imported by the
              # server in which case we could not find the underlying module so we re-raise
              # this error.
              # We distinguish these cases by checking if the executable is the
              # python_executable the server should be using
              if sys.executable == "{python_executable}":
                  raise
              # print("Env escape using executable {python_executable}")
          else:
              # Inverse logic as above here.
              if sys.executable != "{python_executable}":
                  # We use the package locally and warn user.
                  print("Not using environment escape for '%s' as module present" % prefix)
              # In both cases, we don't load our loader since
              # the package is locally present
              sys.path = old_paths
              return
      sys.path = old_paths
      m = ModuleImporter("{python_executable}", "{pythonpath}", {max_pickle_version}, "{path}", {prefixes})
      sys.meta_path.insert(0, m)
      # Reload this module using the ModuleImporter
      importlib.import_module("{module_name}")
  
  if not "{python_executable}":
      raise RuntimeError(
          "Trying to access an escaped module ({module_name}) without a valid interpreter")
  load()
  """.format(
                                      python_executable=ENV_ESCAPE_PY,
                                      pythonpath=ENV_ESCAPE_PATHS,
                                      max_pickle_version=int(
                                          ENV_ESCAPE_PICKLE_VERSION
                                      ),
                                      path=path,
                                      prefixes=module_names,
                                      module_name=module_name,
                                  )
                              )
  
file_path: metaflow/metaflow/plugins/env_escape/__init__.py
imports: import os
  import pickle
  import sys
  from subprocess import Popen, PIPE
  from itertools import chain
  from metaflow.extension_support import get_modules
  from .exception_transferer import RemoteInterpreterException
  from .client_modules import create_modules
label_desc: Use image node_id 1 for calling a global function with example usage: generate_trampolines(out_dir) without return types