code: def _check_approximate_seasonality(
      series: TimeSeries,
      seasonality_period: int,
      period_error_margin: int,
      max_seasonality_order: int,
  ) -> bool:
      """Checks whether the given series has a given seasonality.
  
      Analyzes the given TimeSeries instance for seasonality of the given period
      while taking into account potential noise of the autocorrelation function.
      This is done by averaging all AC values that are within `period_error_margin`
      steps from the index `seasonality_period` in the ACF domain.
  
      Parameters
      ----------
      series
          The TimeSeries instance to be analyzed.
      seasonality_period
          The (approximate) period to be checked for seasonality.
      period_error_margin
          The radius around the `seasonality_period` that is taken into consideration when computing the autocorrelation.
      max_seasonality_order
          The maximum number of lags (or inputs to the acf) that can exceed the ac value computed over the interval
          around `seasonality_period`. The lower this number, the stricter the criterion for seasonality.
  
      Returns
      -------
      bool
          Boolean value indicating whether the seasonality is significant given the parameters passed.
      """
      # fraction of seasonality_period that will skipped when looking at acf values due to high
      # autocorrelation for small lags
      frac = 1 / 4
  
      # return False if there are not enough entries in the TimeSeries instance
      if len(series) < seasonality_period * (1 + frac):
          return False
  
      # compute relevant autocorrelation values
      r = acf(
          series.univariate_values(),
          nlags=int(seasonality_period * (1 + frac)),
          fft=False,
      )
  
      # compute the approximate autocorrelation value for the given period
      left_bound = seasonality_period - period_error_margin
      right_bound = seasonality_period + period_error_margin
      approximation_interval = range(left_bound, right_bound + 1)
      approximated_period_ac = np.mean(r[approximation_interval])
  
      # compute the number of ac values larger than the approximated ac value for the given period
      indices = list(
          range(int(frac * seasonality_period), left_bound)
      ) + list(range(right_bound + 1, len(r)))
      order = sum(
          map(
              lambda ac_value: int(ac_value > approximated_period_ac),
              r[indices],
          )
      )
  
      return order <= max_seasonality_order
  
imports: from typing import Callable, Optional
  import numpy
  import pandas
  from statsmodels.tsa.stattools import acf
  from darts.logging import get_logger
  from darts.models.forecasting.forecasting_model import LocalForecastingModel
  from darts.timeseries import TimeSeries
  from darts.utils.missing_values import fill_missing_values
label_desc: Use image node_id 1 for calling a global function with example usage: _check_approximate_seasonality(series, seasonality_period, period_error_margin, max_seasonality_order) and returns: unknown, False