code: def test_Sarimax_apply_refit_True():
      """
      Test Sarimax apply with refit `True`. It is tested with the
      skforecast wrapper and the statsmodels SARIMAX.
      """
  
      refit = True
  
      # skforecast
      sarimax = Sarimax(
          order=(1, 0, 1), maxiter=1000, method="cg", disp=False
      )
      sarimax.fit(y=y_numpy, exog=exog_numpy)
      sarimax.apply(y=y_lw_numpy, exog=exog_lw_numpy, refit=refit)
      preds_skforecast = sarimax.predict(
          steps=10, exog=exog_lw_predict_numpy
      )
  
      # statsmodels
      sarimax = SARIMAX(order=(1, 0, 1), endog=y_numpy, exog=exog_numpy)
      sarimax_res = sarimax.fit(maxiter=1000, method="cg", disp=False)
      updated_res = sarimax_res.apply(
          endog=y_lw_numpy,
          exog=exog_lw_numpy,
          refit=refit,
          fit_kwargs={
              "method": "cg",
              "maxiter": 1000,
              "start_params": None,
              "disp": True,
          },
      )
      preds_statsmodels = updated_res.get_forecast(
          steps=10, exog=exog_lw_predict_numpy
      ).predicted_mean
  
      # This is the same as creating a new SARIMAX and fitting with the new data
      sarimax = SARIMAX(
          order=(1, 0, 1), endog=y_lw_numpy, exog=exog_lw_numpy
      )
      sarimax_res = sarimax.fit(maxiter=1000, method="cg", disp=False)
      preds_statsmodels_2 = updated_res.get_forecast(
          steps=10, exog=exog_lw_predict_numpy
      ).predicted_mean
  
      # expected = np.array([0.76718596, 0.75795261, 0.79506182, 0.81508184, 0.83164173,
      #                      0.84979957, 0.81751954, 0.78846941, 0.75867965, 0.72695935])
  
      # np.testing.assert_almost_equal(preds_skforecast, expected)
      # np.testing.assert_almost_equal(preds_statsmodels, expected)
      # np.testing.assert_almost_equal(preds_statsmodels_2, expected)
      np.testing.assert_almost_equal(
          preds_skforecast, preds_statsmodels
      )
      np.testing.assert_almost_equal(
          preds_skforecast, preds_statsmodels_2
      )
  
imports: import re
  import pytest
  import numpy
  import pandas
  from sklearn.exceptions import NotFittedError
  from skforecast.Sarimax import Sarimax
  from statsmodels.tsa.statespace.sarimax import SARIMAX
  from statsmodels.tsa.statespace.sarimax import SARIMAXResults
  from statsmodels.tsa.statespace.sarimax import SARIMAXResultsWrapper
  from .fixtures_Sarimax import y
  from .fixtures_Sarimax import y_lw
  from .fixtures_Sarimax import exog
  from .fixtures_Sarimax import exog_lw
  from .fixtures_Sarimax import exog_predict
  from .fixtures_Sarimax import exog_lw_predict
  from .fixtures_Sarimax import y_datetime
  from .fixtures_Sarimax import exog_datetime
  from .fixtures_Sarimax import exog_predict_datetime
label_desc: Use image node_id 18 for calling a global function with example usage: test_Sarimax_apply_refit_True() without return types