code: def _check_cointegrating_regression(
      y: ArrayLike1D,
      x: ArrayLike2D,
      trend: UnitRootTrend,
      supported_trends: tuple[str, ...] = ("n", "c", "ct", "ctt"),
  ) -> CointegrationSetup:
      y = ensure1d(y, "y", True)
      x = ensure2d(x, "x")
      if y.shape[0] != x.shape[0]:
          raise ValueError(
              f"The number of observations in y and x differ. y has "
              f"{y.shape[0]} observtations, and x has {x.shape[0]}."
          )
      if not isinstance(x, pd.DataFrame):
          cols = [f"x{i}" for i in range(1, x.shape[1] + 1)]
          assert isinstance(y, pd.Series)
          x_df = pd.DataFrame(x, columns=cols, index=y.index)
      else:
          x_df = x
      trend_name = trend.lower()
      if trend_name.lower() not in supported_trends:
          trends = ",".join([f'"{st}"' for st in supported_trends])
          raise ValueError(
              f"Unknown trend. Must be one of {{{trends}}}"
          )
      return CointegrationSetup(
          y, x_df, cast(UnitRootTrend, trend_name)
      )
  
imports: from __future__ import annotations
  from typing import Any, NamedTuple, cast
  import pandas
  from statsmodels.iolib.summary import Summary
  from statsmodels.regression.linear_model import OLS, RegressionResults
  import arch.covariance.kernel
  from arch.typing import ArrayLike1D, ArrayLike2D, UnitRootTrend
  from arch.utility.array import ensure1d, ensure2d
  from arch.utility.timeseries import add_trend
label_desc: Use image node_id 2 for calling a global function with example usage: _check_cointegrating_regression(y, x, trend, supported_trends) and returns: CointegrationSetup