code: def convolve_stack(data, kernel, rot_kernel=False, method='scipy'):
      r
  
      if rot_kernel:
          kernel = rotate_stack(kernel)
  
      return np.array([convolve(data_i, kernel_i, method=method) for data_i,
                      kernel_i in zip(data, kernel)])
docs: r"""Convolve stack of data with stack of kernels
  
      This method convolves the input data with a given kernel using FFT and
      is the default convolution used for all routines
  
      Parameters
      ----------
      data : np.ndarray
          Input data array, normally a 2D image
      kernel : np.ndarray
          Input kernel array, normally a 2D kernel
      rot_kernel : bool
          Option to rotate kernels by 180 degrees
      method : str {'astropy', 'scipy'}, optional
          Convolution method (default is 'scipy')
  
      Returns
      -------
      np.ndarray convolved data
  
      Examples
      --------
      >>> from math.convolve import convolve
      >>> import numpy as np
      >>> a = np.arange(18).reshape(2, 3, 3)
      >>> b = a + 10
      >>> convolve_stack(a, b)
      array([[[  534.,   525.,   534.],
              [  453.,   444.,   453.],
              [  534.,   525.,   534.]],
      <BLANKLINE>
             [[ 2721.,  2712.,  2721.],
              [ 2640.,  2631.,  2640.],
              [ 2721.,  2712.,  2721.]]])
  
      >>> convolve_stack(a, b, rot_kernel=True)
      array([[[  474.,   483.,   474.],
          [  555.,   564.,   555.],
          [  474.,   483.,   474.]],
      <BLANKLINE>
         [[ 2661.,  2670.,  2661.],
          [ 2742.,  2751.,  2742.],
          [ 2661.,  2670.,  2661.]]])
  
      See Also
      --------
      convolve : The convolution function called by convolve_stack