code: def estimate_ringing_samples(system, max_try=100000):
      """Estimate filter ringing.
  
      Parameters
      ----------
      system : tuple | ndarray
          A tuple of (b, a) or ndarray of second-order sections coefficients.
      max_try : int
          Approximate maximum number of samples to try.
          This will be changed to a multiple of 1000.
  
      Returns
      -------
      n : int
          The approximate ringing.
      """
      if isinstance(system, tuple):  # TF
          kind = "ba"
          b, a = system
          zi = [0.0] * (len(a) - 1)
      else:
          kind = "sos"
          sos = system
          zi = [[0.0] * 2] * len(sos)
      n_per_chunk = 1000
      n_chunks_max = int(np.ceil(max_try / float(n_per_chunk)))
      x = np.zeros(n_per_chunk)
      x[0] = 1
      last_good = n_per_chunk
      thresh_val = 0
      for ii in range(n_chunks_max):
          if kind == "ba":
              h, zi = signal.lfilter(b, a, x, zi=zi)
          else:
              h, zi = signal.sosfilt(sos, x, zi=zi)
          x[0] = 0  # for subsequent iterations we want zero input
          h = np.abs(h)
          thresh_val = max(0.001 * np.max(h), thresh_val)
          idx = np.where(np.abs(h) > thresh_val)[0]
          if len(idx) > 0:
              last_good = idx[-1]
          else:  # this iteration had no sufficiently lange values
              idx = (ii - 1) * n_per_chunk + last_good
              break
      else:
          warn("Could not properly estimate ringing for the filter")
          idx = n_per_chunk * n_chunks_max
      return idx
  
imports: from collections import Counter
  from copy import deepcopy
  from functools import partial
  from math import gcd
  import numpy
  from scipy import fft, signal
  from scipy.stats import f
  from ._fiff.pick import _picks_to_idx
  from ._ola import _COLA
  from .cuda import _fft_multiply_repeated, _fft_resample, _setup_cuda_fft_multiply_repeated, _setup_cuda_fft_resample, _smart_pad
  from .parallel import parallel_func
  from .utils import _check_option, _check_preload, _ensure_int, _pl, _validate_type, logger, sum_squared, verbose, warn
label_desc: Use image node_id 12 for calling a global function with example usage: estimate_ringing_samples(system, max_try) and returns: idx