code: def adf_test(series, **kw):
      """
      Wrapper for the augmented Dickey-Fuller test. Allows users to set the lag order.
  
      :param series: series to test
      :return: dictionary of results
      """
      if "lags" in kw.keys():
          msg = "Lag order of {} detected. Running the ADF test...".format(
              str(kw["lags"])
          )
          print(msg)
          statistic, pval, critval, resstore = stattools.adfuller(
              series,
              maxlag=kw["lags"],
              autolag=kw["autolag"],
              store=kw["store"],
          )
      else:
          statistic, pval, critval, resstore = stattools.adfuller(
              series, autolag=kw["IC"], store=kw["store"]
          )
  
      output = {
          "statistic": statistic,
          "pval": pval,
          "critical": critval,
          "resstore": resstore,
      }
      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 1 for calling a global function with example usage: adf_test(series) and returns: output