code: def _is_stationary_kpss(
      data: pd.Series,
      data_name: Optional[str] = None,
      alpha: float = 0.05,
      verbose: bool = False,
      data_kwargs: Optional[Dict] = None,
  ) -> Tuple[Union[bool, List[bool]], Optional[pd.DataFrame]]:
      """Checks Stationarity around a deterministic trend (KPSS Test)
  
      H0: The time series is trend stationary
      H1: The time series is not trend stationary
  
      If not trend stationary, then try removing trend.
  
      Parameters
      ----------
      data : pd.Series
          Time Series data on which the test needs to be performed
      alpha : float, optional
          Significance Level, by default 0.05
      verbose : bool, optional
          If False, returns boolean value(s) for whether the data is stationary
          or not. If True, then it returns the detailed results dataframe along
          with the boolean value(s), by default False
      data_kwargs : Optional[Dict], optional
          Users can specify `lags list` or `order_list` to run the test for the
          data as well as for its lagged versions, by default None
  
          >>> _is_stationary_kpss(data=data, data_kwargs={"order_list": [1, 2]})
          >>> _is_stationary_kpss(data=data, data_kwargs={"lags_list": [1, [1, 12]]})
  
      Returns
      -------
      Tuple[Union[bool, List[bool]], Optional[pd.DataFrame]]
          If verbose=False, returns boolean value(s) for whether the data is stationary
          or not. If test for lags/orders are not requested, then returns a single
          boolean value corresponding to the data. If tests are requested for
          lags/orders (using kwargs), then returns a list of boolean values
          corresponding to the data and the lags/order specified by user (in that
          order). If verbose=True, then it returns the detailed results dataframe
          along with the boolean value(s).
      """
  
      test_category = "Stationarity"
  
      # Step 1: Get list of all data that needs to be tested ----
      diff_list, name_list = _get_diff_name_list(
          data=data, data_name=data_name, data_kwargs=data_kwargs
      )
  
      # Step 2: Test all data ----
      results_list = []
      is_stationary_list = []
      for data_, name_ in zip(diff_list, name_list):
          # Step 2A: Validate inputs and adjust as needed ----
          if len(data_) == 0:
              # Differencing led to no remaining data, hence skip it
              continue
  
          # Step 2B: Get Test Results ----
          try:
              results_ = kpss(data_, regression="ct", nlags="auto")
          except ValueError as exception:
              logger.warning(exception)
              if data_.isna().sum() > 0:
                  raise MissingDataError(
                      "KPSS test can not be run on data with missing values. "
                      "Please check input data type."
                  )
              else:
                  raise ValueError()
          test_statistic = results_[0]
          p_value = results_[1]
          critical_values = results_[3]
          is_stationary = False if p_value < alpha else True
  
          # Step 2C: Create Result DataFrame ----
          results_dict = {
              "Trend Stationarity": is_stationary,
              "p-value": p_value,
              "Test Statistic": test_statistic,
          }
          critical_values = {
              f"Critical Value {key}": value
              for key, value in critical_values.items()
          }
          results_dict.update(critical_values)
          results = pd.DataFrame(
              results_dict, index=["Value"]
          ).T.reset_index()
          results["Data"] = name_
  
          # Step 2D: Update list of all results ----
          results_list.append(results)
          is_stationary_list.append(is_stationary)
  
      # Step 3: Combine all results ----
      results = pd.concat(results_list)
      results.reset_index(inplace=True)
  
      # Step 4: Add Settings & Format Results ----
      def add_and_format_settings(row):
          row["Setting"] = {"alpha": alpha}
          return row
  
      results = results.apply(add_and_format_settings, axis=1)
      results = _format_test_results(results, test_category, "KPSS")
  
      # Step 5: Return values ----
      if len(is_stationary_list) == 1:
          is_stationary_list = is_stationary_list[0]
      if verbose:
          return is_stationary_list, results
      else:
          return is_stationary_list
  
imports: from typing import Dict, List, Optional, Tuple, Union
  import numpy
  import pandas
  import statsmodels.api
  from pmdarima.arima.utils import ndiffs, nsdiffs
  from statsmodels.tools.sm_exceptions import MissingDataError
  from statsmodels.tsa.api import kpss
  from statsmodels.tsa.stattools import adfuller
  from pycaret.internal.logging import get_logger
  from pycaret.internal.tests import _format_test_results
  from pycaret.internal.tests.stats import _is_gaussian, _summary_stats
  from pycaret.utils.time_series import _get_diff_name_list
  from pycaret.utils.time_series.exceptions import MissingDataError
label_desc: Use image node_id 5 for calling a global function with example usage: _is_stationary_kpss(data, data_name, alpha, verbose, data_kwargs) and returns: row, is_stationary_list,  results, is_stationary_list