code: def _mt_spectrum_remove_win(
      x,
      sfreq,
      line_freqs,
      notch_widths,
      window_fun,
      threshold,
      get_thresh,
  ):
      n_times = x.shape[-1]
      n_samples = window_fun.shape[1]
      n_overlap = (n_samples + 1) // 2
      x_out = np.zeros_like(x)
      rm_freqs = list()
      idx = [0]
  
      # Define how to process a chunk of data
      def process(x_):
          out = _mt_spectrum_remove(
              x_,
              sfreq,
              line_freqs,
              notch_widths,
              window_fun,
              threshold,
              get_thresh,
          )
          rm_freqs.append(out[1])
          return (out[0],)  # must return a tuple
  
      # Define how to store a chunk of fully processed data (it's trivial)
      def store(x_):
          stop = idx[0] + x_.shape[-1]
          x_out[..., idx[0] : stop] += x_
          idx[0] = stop
  
      _COLA(
          process,
          store,
          n_times,
          n_samples,
          n_overlap,
          sfreq,
          verbose=False,
      ).feed(x)
      assert idx[0] == n_times
      return x_out, rm_freqs
  
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 20 for calling a global function with example usage: _mt_spectrum_remove_win(x, sfreq, line_freqs, notch_widths, window_fun, threshold, get_thresh) and returns: x_out,  rm_freqs, out