code: def get_best_model_from_results_df(
      nixtla_results_df, metric=r2_score
  ):
      """Gets the best model based, on lowest error, from a results df
      with a column for each nixtla model.
      """
      best_model, current_accuracy = None, 0
      accuracy_dict = get_model_accuracy_dict(nixtla_results_df, metric)
      for model, accuracy in accuracy_dict.items():
          if accuracy > current_accuracy:
              best_model, current_accuracy = model, accuracy
      return best_model
  
file_path: mindsdb/mindsdb/integrations/utilities/time_series_utils.py
imports: import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  from sklearn.metrics import r2_score
  from mindsdb.utilities import log
label_desc: Use image node_id 5 for calling a global function with example usage: get_best_model_from_results_df(nixtla_results_df, metric) and returns: best_model