code: def level_sample_data(request):
      """Generate sample data for a given model specification.
  
      We add external regressors and a seasonality component.
      """
      min_date = pd.to_datetime("2017-01-01")
      max_date = pd.to_datetime("2022-01-01")
  
      data_df = pd.DataFrame(
          data={
              "date": pd.date_range(
                  start=min_date, end=max_date, freq="M"
              )
          }
      )
  
      n = data_df.shape[0]
      model_spec = request.param
      y, _, _ = model_spec.generate_parametrized_sample_data(n=n)
  
      data_df["y"] = y
      # Add external regressor.
      x = np.random.uniform(low=0.0, high=1.0, size=n)
      data_df["x"] = np.where(x > 0.70, x, 0)
      # Add seasonal component.
      data_df["cs"] = np.sin(
          2 * np.pi * data_df["date"].dt.dayofyear / 356.5
      )
      data_df["cc"] = np.cos(
          3 * np.pi * data_df["date"].dt.dayofyear / 356.5
      )
      data_df["s"] = data_df["cs"] + data_df["cc"]
      # Construct target variable.
      data_df["z"] = data_df["y"] + data_df["x"] + data_df["s"]
      return model_spec.level, data_df
  
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 1 for calling a global function with example usage: level_sample_data(request) and returns: model_spec,  data_df