code: def create_scaffolding(experiment, sorted_ingredients):
      scaffolding = OrderedDict()
      for ingredient in sorted_ingredients[:-1]:
          scaffolding[ingredient] = Scaffold(
              config_scopes=ingredient.configurations,
              subrunners=OrderedDict(
                  [
                      (scaffolding[m].path, scaffolding[m])
                      for m in ingredient.ingredients
                  ]
              ),
              path=ingredient.path,
              captured_functions=ingredient.captured_functions,
              commands=ingredient.commands,
              named_configs=ingredient.named_configs,
              config_hooks=ingredient.config_hooks,
              generate_seed=False,
          )
  
      scaffolding[experiment] = Scaffold(
          experiment.configurations,
          subrunners=OrderedDict(
              [
                  (scaffolding[m].path, scaffolding[m])
                  for m in experiment.ingredients
              ]
          ),
          path="",
          captured_functions=experiment.captured_functions,
          commands=experiment.commands,
          named_configs=experiment.named_configs,
          config_hooks=experiment.config_hooks,
          generate_seed=True,
      )
  
      scaffolding_ret = OrderedDict(
          [(sc.path, sc) for sc in scaffolding.values()]
      )
      if len(scaffolding_ret) != len(scaffolding):
          raise ValueError(
              "The pathes of the ingredients are not unique. "
              "{}".format([s.path for s in scaffolding])
          )
  
      return scaffolding_ret
  
imports: import os
  from collections import OrderedDict, defaultdict
  from copy import copy, deepcopy
  from sacred.config import ConfigDict, chain_evaluate_config_scopes, dogmatize, load_config_file, undogmatize
  from sacred.config.config_summary import ConfigSummary
  from sacred.config.custom_containers import make_read_only
  from sacred.host_info import get_host_info
  from sacred.randomness import create_rnd, get_seed
  from sacred.run import Run
  from sacred.utils import convert_to_nested_dict, create_basic_stream_logger, get_by_dotted_path, is_prefix, rel_path, iterate_flattened, set_by_dotted_path, recursive_update, iter_prefixes, join_paths, NamedConfigNotFoundError, ConfigAddedError
  from sacred.settings import SETTINGS
label_desc: Use image node_id 4 for calling a global function with example usage: create_scaffolding(experiment, sorted_ingredients) and returns: scaffolding_ret