code: def import_bundle_algo_history(
      output_folder: str = ".",
      template_path: str | None = None,
      only_trained: bool = True,
  ) -> list:
      """
      import the history of the bundleAlgo objects as a list of algo dicts.
      each algo_dict has keys name (folder name), algo (bundleAlgo), is_trained (bool),
  
      Args:
          output_folder: the root path of the algorithms templates.
          template_path: the algorithm_template. It must contain algo.py in the follow path:
              ``{algorithm_templates_dir}/{network}/scripts/algo.py``.
          only_trained: only read the algo history if the algo is trained.
      """
  
      history = []
  
      for name in sorted(os.listdir(output_folder)):
          write_path = os.path.join(output_folder, name)
  
          if not os.path.isdir(write_path):
              continue
  
          obj_filename = os.path.join(write_path, "algo_object.pkl")
          if not os.path.isfile(obj_filename):  # saved mode pkl
              continue
  
          algo, algo_meta_data = algo_from_pickle(
              obj_filename, template_path=template_path
          )
  
          best_metric = algo_meta_data.get(AlgoKeys.SCORE, None)
          if best_metric is None:
              try:
                  best_metric = algo.get_score()
              except BaseException:
                  pass
  
          is_trained = best_metric is not None
  
          if (only_trained and is_trained) or not only_trained:
              history.append(
                  {
                      AlgoKeys.ID: name,
                      AlgoKeys.ALGO: algo,
                      AlgoKeys.SCORE: best_metric,
                      AlgoKeys.IS_TRAINED: is_trained,
                  }
              )
  
      return history
  
file_path: MONAI/monai/apps/auto3dseg/utils.py
imports: from __future__ import annotations
  import os
  from monai.apps.auto3dseg.bundle_gen import BundleAlgo
  from monai.auto3dseg import algo_from_pickle, algo_to_pickle
  from monai.utils.enums import AlgoKeys
label_desc: Use image node_id 1 for calling a global function with example usage: import_bundle_algo_history(output_folder, template_path, only_trained) and returns: history