code: def kpss_test(series, **kw):
      """
      Wrapper for the KPSS test. Allows users to set the lag order.
  
      :param series: series to test
      :return: dictionary of results
      """
      if kw["store"]:
          statistic, p_value, critical_values, rstore = stattools.kpss(
              series,
              regression=kw["reg_type"],
              nlags=kw["lags"],
              store=kw["store"],
          )
      else:
          statistic, p_value, lags, critical_values = stattools.kpss(
              series, regression=kw["reg_type"], nlags=kw["lags"]
          )
      output = {
          "statistic": statistic,
          "pval": p_value,
          "critical": critical_values,
          "lags": rstore.lags if kw["store"] else lags,
      }
  
      if kw["store"]:
          output.update({"resstore": rstore})
      return output
  
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 2 for calling a global function with example usage: kpss_test(series) and returns: output