docs: def assemble_experiment_temp_dir(config):
      """Create a temp directory from which to run an experiment.
      The new directory will include:
      - Copies of custom experiment files which don't match the exclusion policy
      - Templates and static resources from Dallinger
      - An export of the loaded configuration
      - Heroku-specific files (Procile, runtime.txt) from Dallinger
  
      Assumes the experiment root directory is the current working directory.
  
      Returns the absolute path of the new directory.
      """
      app_id = config.get("id")
      dst = os.path.join(tempfile.mkdtemp(), app_id)
  
      # Copy local experiment files, minus some
      shutil.copytree(os.getcwd(), dst, ignore=exclusion_policy())
  
      # Export the loaded configuration
      config.write(filter_sensitive=True, directory=dst)
  
      # Save the experiment id
      with open(os.path.join(dst, "experiment_id.txt"), "w") as file:
          file.write(app_id)
  
      # Copy Dallinger files
      dallinger_root = dallinger_package_path()
      ensure_directory(os.path.join(dst, "static", "scripts"))
      ensure_directory(os.path.join(dst, "static", "css"))
      frontend_files = [
          os.path.join("static", "css", "dallinger.css"),
          os.path.join("static", "scripts", "dallinger2.js"),
          os.path.join("static", "scripts", "reqwest.min.js"),
          os.path.join("static", "scripts", "require.js"),
          os.path.join("static", "scripts", "reconnecting-websocket.js"),
          os.path.join("static", "scripts", "spin.min.js"),
          os.path.join("static", "scripts", "tracker.js"),
          os.path.join("static", "scripts", "store+json2.min.js"),
          os.path.join("templates", "error.html"),
          os.path.join("templates", "error-complete.html"),
          os.path.join("templates", "launch.html"),
          os.path.join("templates", "complete.html"),
          os.path.join("templates", "questionnaire.html"),
          os.path.join("templates", "thanks.html"),
          os.path.join("templates", "waiting.html"),
          os.path.join("static", "robots.txt"),
      ]
      frontend_dirs = [os.path.join("templates", "base")]
      for filename in frontend_files:
          src = os.path.join(dallinger_root, "frontend", filename)
          dst_filepath = os.path.join(dst, filename)
          if not os.path.exists(dst_filepath):
              shutil.copy(src, dst_filepath)
      for filename in frontend_dirs:
          src = os.path.join(dallinger_root, "frontend", filename)
          dst_filepath = os.path.join(dst, filename)
          if not os.path.exists(dst_filepath):
              shutil.copytree(src, dst_filepath)
  
      # Copy Heroku files
      heroku_files = ["Procfile", "runtime.txt"]
      for filename in heroku_files:
          src = os.path.join(dallinger_root, "heroku", filename)
          shutil.copy(src, os.path.join(dst, filename))
  
      if not config.get("clock_on"):
          # If the clock process has been disabled, overwrite the Procfile:
          src = os.path.join(dallinger_root, "heroku", "Procfile_no_clock")
          shutil.copy(src, os.path.join(dst, "Procfile"))
  
      return dst