code: def unit_root_test_wrapper(series, lags=None):
      """
      Main function to run multiple stationarity tests. Runs five tests and returns a summary table + decision
      based on the majority rule. If the number of tests that determine a series is stationary equals to the
      number of tests that deem it non-stationary, we assume the series is non-stationary.
          * Augmented Dickey-Fuller (ADF),
          * KPSS,
          * ADF using GLS,
          * Phillips-Perron (PP),
          * Zivot-Andrews (ZA)
  
      :param lags: (optional) parameter that allows user to run a series of tests for a specific lag value.
      :param series: series to test
      :return: dictionary of summary table for all tests and final decision on stationary vs nonstaionary
      """
      # setting for ADF and KPSS tests
      adf_settings = {"IC": "AIC", "store": True}
  
      kpss_settings = {"reg_type": "c", "lags": "auto", "store": True}
  
      arch_test_settings = {}  # settings for PP, ADF GLS and ZA tests
      if lags is not None:
          adf_settings.update({"lags": lags, "autolag": None})
          kpss_settings.update({"lags:": lags})
          arch_test_settings = {"lags": lags}
      # Run individual tests
      adf = adf_test(series, **adf_settings)  # ADF test
      kpss = kpss_test(series, **kpss_settings)  # KPSS test
      pp = unitroot.PhillipsPerron(
          series, **arch_test_settings
      )  # Phillips-Perron test
      adfgls = unitroot.DFGLS(
          series, **arch_test_settings
      )  # ADF using GLS test
      za = unitroot.ZivotAndrews(
          series, **arch_test_settings
      )  # Zivot-Andrews test
  
      # generate output table
      adf_dict = format_test_output(
          test_name="ADF", test_res=adf, H0_unit_root=True
      )
      kpss_dict = format_test_output(
          test_name="KPSS", test_res=kpss, H0_unit_root=False
      )
      pp_dict = format_test_output(
          test_name="Philips Perron", test_res=pp, H0_unit_root=True
      )
      adfgls_dict = format_test_output(
          test_name="ADF GLS", test_res=adfgls, H0_unit_root=True
      )
      za_dict = format_test_output(
          test_name="Zivot-Andrews", test_res=za, H0_unit_root=True
      )
  
      test_dict = {
          "ADF": adf_dict,
          "KPSS": kpss_dict,
          "PP": pp_dict,
          "ADF GLS": adfgls_dict,
          "ZA": za_dict,
      }
      test_sum = pd.DataFrame.from_dict(
          test_dict, orient="index"
      ).reset_index(drop=True)
  
      # decision based on the majority rule
      if test_sum.shape[0] > 0:
          ratio = (
              test_sum[test_sum["stationary"] == "yes"].shape[0]
              / test_sum.shape[0]
          )
      else:
          ratio = 1  # all tests fail, assume the series is stationary
  
      # Majority rule. If the ratio is exactly 0.5, assume the series in non-stationary.
      stationary = "YES" if (ratio > 0.5) else "NO"
  
      out = {"summary": test_sum, "stationary": stationary}
      return out
  
file_path: MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/forecasting-recipes-univariate/helper_functions.py
imports: import pandas
  import statsmodels.tsa.stattools
  from arch import unitroot
  from azureml.automl.core.shared import constants
  from azureml.automl.runtime.shared.score import scoring
label_desc: Use image node_id 4 for calling a global function with example usage: unit_root_test_wrapper(series, lags) and returns: out