freq    : The frequency above which signals are attenuated
              with 95 dB
    sr      : Sampling rate in Hz.
    maxorder: Maximal order of the designed cheby2 filter

    Returns --> (b coeffs, a coeffs, freq_passband)

def lowpass_cheby2_coeffs(freq, sr, maxorder=12):
    # type: (float, int, int) -> Tuple[np.ndarray, np.ndarray, float]
    """
    freq    : The frequency above which signals are attenuated
              with 95 dB
    sr      : Sampling rate in Hz.
    maxorder: Maximal order of the designed cheby2 filter

    Returns --> (b coeffs, a coeffs, freq_passband)
    """
    
    nyquist = sr * 0.5
    # rp - maximum ripple of passband, rs - attenuation of stopband
    rp, rs, order = 1, 96, 1e99
    ws = freq / nyquist  # stop band frequency
    wp = ws              # pass band frequency
    # raise for some bad scenarios
    if ws > 1:
        ws = 1.0
        msg = "Selected corner frequency is above Nyquist. " + \
              "Setting Nyquist as high corner."
        warnings.warn(msg)
    while True:
        if order <= maxorder:
            break
        wp = wp * 0.99
        order, wn = signal.cheb2ord(wp, ws, rp, rs, analog=0)
    b, a = signal.cheby2(order, rs, wn, btype='low', analog=0, output='ba')
    return b, a, wp*nyquist