code: def test_evaluate_grid_hyperparameters_sarimax_when_return_best():
      """
      Test forecaster is refitted when return_best=True in
      _evaluate_grid_hyperparameters_sarimax.
      """
      forecaster = ForecasterSarimax(
          regressor=Sarimax(
              order=(3, 2, 0), maxiter=1000, method="cg", disp=False
          )
      )
  
      param_grid = [
          {"order": (3, 2, 0), "trend": None},
          {"order": (3, 2, 0), "trend": "c"},
      ]
  
      _evaluate_grid_hyperparameters_sarimax(
          forecaster=forecaster,
          y=y_datetime,
          param_grid=param_grid,
          steps=3,
          refit=True,
          metric=mean_absolute_error,
          initial_train_size=len(y_datetime) - 12,
          fixed_train_size=True,
          return_best=True,
          suppress_warnings_fit=False,
          verbose=False,
      )
  
      expected_params = {
          "concentrate_scale": False,
          "dates": None,
          "disp": False,
          "enforce_invertibility": True,
          "enforce_stationarity": True,
          "freq": None,
          "hamilton_representation": False,
          "maxiter": 1000,
          "measurement_error": False,
          "method": "cg",
          "missing": "none",
          "mle_regression": True,
          "order": (3, 2, 0),
          "seasonal_order": (0, 0, 0, 0),
          "simple_differencing": False,
          "sm_fit_kwargs": {},
          "sm_init_kwargs": {},
          "sm_predict_kwargs": {},
          "start_params": None,
          "time_varying_regression": False,
          "trend": None,
          "trend_offset": 1,
          "use_exact_diffuse": False,
          "validate_specification": True,
      }
  
      assert expected_params == forecaster.params
  
imports: import re
  import pytest
  import platform
  import numpy
  import pandas
  from sklearn.metrics import mean_absolute_error
  from pmdarima.arima import ARIMA
  from skforecast.Sarimax import Sarimax
  from skforecast.ForecasterSarimax import ForecasterSarimax
  from skforecast.model_selection_sarimax.model_selection_sarimax import _evaluate_grid_hyperparameters_sarimax
  from tqdm import tqdm
  from functools import partialmethod
  from ...ForecasterSarimax.tests.fixtures_ForecasterSarimax import y_datetime
  from ...ForecasterSarimax.tests.fixtures_ForecasterSarimax import exog_datetime
label_desc: Use image node_id 6 for calling a global function with example usage: test_evaluate_grid_hyperparameters_sarimax_when_return_best() without return types