code: def test_result_consistency_exog(level_sample_data_split):
      """Check consistency between wrapper and statsmodels original implementation.
  
      We add external regressors and a seasonality component.
      """
      from statsmodels.tsa.statespace.structural import (
          UnobservedComponents as _UnobservedComponents,
      )
  
      level, y_train, X_train, X_test, fh = level_sample_data_split
  
      model_spec = {
          "level": level,
          "freq_seasonal": [{"period": 12, "harmonics": 4}],
          "autoregressive": 1,
          "mle_regression": False,
      }
      # Fit and predict with forecaster.
      forecaster = UnobservedComponents(**model_spec)
      forecaster.fit(y=y_train, X=X_train)
      y_pred_forecaster = forecaster.predict(fh=fh, X=X_test)
      # Fit train statsmodels original model.
      model = _UnobservedComponents(
          endog=y_train, exog=X_train, **model_spec
      )
      result = model.fit(disp=0)
      n_test = X_test.shape[0]
      y_pred_base = result.forecast(steps=n_test, exog=X_test)
      y_pred_base.name = y_train.name
      assert_series_equal(left=y_pred_forecaster, right=y_pred_base)
      assert len(fh) == y_pred_forecaster.shape[0]
  
imports: import numpy
  import pandas
  import pytest
  from pandas.testing import assert_series_equal
  from sktime.datasets import load_airline, load_longley
  from sktime.forecasting.model_evaluation import evaluate
  from sktime.forecasting.structural import UnobservedComponents
  from sktime.split import SlidingWindowSplitter
  from sktime.utils.validation._dependencies import _check_soft_dependencies
label_desc: Use image node_id 5 for calling a global function with example usage: test_result_consistency_exog(level_sample_data_split) without return types