code: def get_training_report(
      validation_field: str,
      validation_metric: str,
      include_test_set: bool,
      train_valiset_stats: Dict[str, Dict[str, List[float]]],
      train_testset_stats: Dict[str, Dict[str, List[float]]],
  ) -> List[Tuple[str, str]]:
      """Returns a training report in the form of a list [(report item, value)]."""
      validation_field_result = train_valiset_stats[validation_field]
      best_function = get_best_function(validation_metric)
  
      training_report = []
      best_vali_index, (
          epoch_best_validation_metric,
          step_best_validation_metric,
          best_validation_metric,
      ) = best_function(
          enumerate(validation_field_result[validation_metric]),
          # -1 for the last element of the TrainerMetric namedtuple.
          key=lambda index_epoch_step_value: index_epoch_step_value[1][
              -1
          ],
      )
      training_report.append(["Validation feature", validation_field])
      training_report.append(["Validation metric", validation_metric])
      training_report.append(
          ["Best model step", step_best_validation_metric]
      )
      training_report.append(
          ["Best model epoch", epoch_best_validation_metric + 1]
      )
      training_report.append(
          [
              f"Best model's validation {validation_metric}",
              best_validation_metric,
          ]
      )
      if include_test_set:
          validation_selected_test_metric_score = train_testset_stats[
              validation_field
          ][validation_metric][best_vali_index][
              -1
          ]  # -1 for the last element of the TrainerMetric namedtuple.
  
          training_report.append(
              [
                  f"Best model's test {validation_metric}",
                  validation_selected_test_metric_score,
              ]
          )
      return training_report
  
imports: import logging
  from collections import defaultdict
  from typing import Dict, List, Tuple, TYPE_CHECKING
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import AUTO, COMBINED, LOSS
  from ludwig.models.base import BaseModel
  from ludwig.modules.metric_modules import get_best_function
  from ludwig.utils.data_utils import save_json
  from ludwig.utils.metric_utils import TrainerMetric
label_desc: Use image node_id 8 for calling a global function with example usage: get_training_report(validation_field, validation_metric, include_test_set, train_valiset_stats, train_testset_stats) and returns: training_report