Taken from https://github.com/jthiem/nnresample

    Resample a signal from rate "down" to rate "up"
    
    Parameters
    ----------
    x : array_like
        The data to be resampled.
    up : int
        The upsampling factor.
    down : int
        The downsampling factor.
    beta : float
        Beta factor for Kaiser window.  Determines tradeoff between
        stopband attenuation and transition band width
    L : int
        FIR filter order.  Determines stopband attenuation.  The higher
        the better, ath the cost of complexity.
    axis : int, optional
        The axis of `x` that is resampled. Default is 0.
        
    Returns
    -------
    resampled_x : array
        The resampled array.
        
    Notes
    -----
    The function keeps a global cache of filters, since they are
    determined entirely by up, down, beta, and L.  If a filter
    has previously been used it is looked up instead of being
    recomputed.

def _resample_nnresample2(s, up, down, beta=5.0, L=16001, axis=0):
    # type: (np.ndarray, float, float, float, int, int) -> np.ndarray
    """
    Taken from https://github.com/jthiem/nnresample

    Resample a signal from rate "down" to rate "up"
    
    Parameters
    ----------
    x : array_like
        The data to be resampled.
    up : int
        The upsampling factor.
    down : int
        The downsampling factor.
    beta : float
        Beta factor for Kaiser window.  Determines tradeoff between
        stopband attenuation and transition band width
    L : int
        FIR filter order.  Determines stopband attenuation.  The higher
        the better, ath the cost of complexity.
    axis : int, optional
        The axis of `x` that is resampled. Default is 0.
        
    Returns
    -------
    resampled_x : array
        The resampled array.
        
    Notes
    -----
    The function keeps a global cache of filters, since they are
    determined entirely by up, down, beta, and L.  If a filter
    has previously been used it is looked up instead of being
    recomputed.
    """       
    # check if a resampling filter with the chosen parameters already exists
    params = (up, down, beta, L)
    if params in _precomputed_filters.keys():
        # if so, use it.
        filt = _precomputed_filters[params]
    else:
        # if not, generate filter, store it, use it
        filt = _nnresample_compute_filt(up, down, beta, L)
        _precomputed_filters[params] = filt
    return sig.resample_poly(s, up, down, window=np.array(filt), axis=axis)