code: def _format_list_of_dicts(scores, output, sorted):
      """
      Format list of score dicts `scores`.
  
      - maybe sort by ppscore
      - maybe return pandas.Dataframe
      - output can be one of ["df", "list"]
      """
      if sorted:
          scores.sort(key=lambda item: item["ppscore"], reverse=True)
  
      if output == "df":
          df_columns = [
              "x",
              "y",
              "ppscore",
              "case",
              "is_valid_score",
              "metric",
              "baseline_score",
              "model_score",
              "model",
          ]
          data = {
              column: [score[column] for score in scores]
              for column in df_columns
          }
          scores = pd.DataFrame.from_dict(data)
  
      return scores
  
imports: import warnings
  import numpy
  import pandas
  from pandas.api.types import is_bool_dtype, is_categorical_dtype, is_datetime64_any_dtype, is_numeric_dtype, is_object_dtype, is_string_dtype, is_timedelta64_dtype
  from sklearn import preprocessing, tree
  from sklearn.metrics import f1_score, mean_absolute_error
  from sklearn.model_selection import cross_val_score
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 14 for calling a global function with example usage: _format_list_of_dicts(scores, output, sorted) and returns: scores