code: def identify_gaps(
      gap: pd.Series, is_datetime: bool, gap_tolerance: int = 2
  ) -> Tuple[pd.Series, list]:
      zero = pd.Timedelta(0) if is_datetime else 0
      diff = gap.diff()
  
      non_zero_diff = diff[diff > zero]
      min_gap_size = gap_tolerance * non_zero_diff.mean()
  
      gap_stats = non_zero_diff[non_zero_diff > min_gap_size]
      anchors = gap[diff > min_gap_size].index
  
      gaps = []
      for i in anchors:
          gaps.append(gap.loc[gap.index[[i - 1, i]]].values)
  
      return gap_stats, gaps
  
file_path: ydata-profiling/src/ydata_profiling/model/pandas/describe_timeseries_pandas.py
imports: from typing import Any, Dict, Tuple
  import numpy
  import pandas
  from scipy.fft import _pocketfft
  from scipy.signal import find_peaks
  from statsmodels.tsa.stattools import adfuller
  from ydata_profiling.config import Settings
  from ydata_profiling.model.summary_algorithms import describe_numeric_1d, describe_timeseries_1d, series_handle_nulls, series_hashable
label_desc: Use image node_id 6 for calling a global function with example usage: identify_gaps(gap, is_datetime, gap_tolerance) and returns: gap_stats,  gaps