code: def stationarity_test_kpss(
      ts: TimeSeries,
      regression: str = "c",
      nlags: Union[str, int] = "auto",
  ) -> set:
      """
      Provides Kwiatkowski-Phillips-Schmidt-Shin test for stationarity for a time series,
      using :func:`statsmodels.tsa.stattools.kpss`. See [1]_.
  
  
      Parameters
      ----------
      ts
          The time series to test.
      regression
          The null hypothesis for the KPSS test.
          'c' : The data is stationary around a constant (default).
          'ct' : The data is stationary around a trend.
      nlags
         Indicates the number of lags to be used. If 'auto' (default), lags is calculated using the data-dependent method
         of Hobijn et al. (1998). See also Andrews (1991), Newey & West (1994), and Schwert (1989). If set to 'legacy',
         uses int(12 * (n / 100)**(1 / 4)) , as outlined in Schwert (1989).
  
      Returns
      -------
      set
          | kpss_stat: The test statistic.
          | pvalue: The p-value of the test. The p-value is interpolated from Table 1 in [2]_,
          | and a boundary point is returned if the test statistic is outside the table of critical values,
          | that is, if the p-value is outside the interval (0.01, 0.1).
          | lags: The truncation lag parameter.
          | crit: The critical values at 10%, 5%, 2.5% and 1%. Based on [2]_.
  
      References
      ----------
      .. [1] https://www.statsmodels.org/dev/generated/statsmodels.tsa.stattools.kpss.html
      .. [2] Kwiatkowski et al. (1992)
      """
      ts._assert_univariate()
      ts._assert_deterministic()
  
      return kpss(ts.values(copy=False), regression, nlags)
  
imports: import math
  from typing import List, Optional, Sequence, Tuple, Union
  import matplotlib.pyplot
  import numpy
  from scipy.signal import argrelmax
  from scipy.stats import norm
  from statsmodels.tsa.seasonal import MSTL, STL, seasonal_decompose
  from statsmodels.tsa.stattools import acf, adfuller, grangercausalitytests, kpss, pacf
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
  from .missing_values import fill_missing_values
  from .utils import ModelMode, SeasonalityMode
label_desc: Use image node_id 8 for calling a global function with example usage: stationarity_test_kpss(ts, regression, nlags) and returns: kpss