code: def format_stats(experiment):
      """Render a string for stat section
  
      Parameters
      ----------
      experiment: `orion.core.worker.experiment.Experiment`
      templates: dict
          templates for the title and `stats`.
          See `format_title` for more info.
  
      """
      stats = experiment.stats
      if not stats.trials_completed:
          return NO_STATS_TEMPLATE.format(title=format_title("Stats"))
  
      best_params = get_trial_params(stats.best_trials_id, experiment)
  
      stats_string = STATS_TEMPLATE.format(
          title=format_title("Stats"),
          stats=stats,
          best_params=format_dict(best_params, depth=2, width=2),
          is_done=experiment.is_done,
      )
  
      return stats_string
  
file_path: orion/src/orion/core/utils/format_terminal.py
label_desc: Use image node_id 12 for calling a global function with example usage: format_stats(experiment) and returns: stats_string, NO_STATS_TEMPLATE