def iirdesign(wp, ws, gpass, gstop, analog=False, ftype='ellip', output='ba'):
    try:
        ordfunc = filter_dict[ftype][1]
    except KeyError:
        raise ValueError("Invalid IIR filter type: %s" % ftype)
    except IndexError:
        raise ValueError(("%s does not have order selection. Use "
                          "iirfilter function.") % ftype)

    wp = atleast_1d(wp)
    ws = atleast_1d(ws)
    band_type = 2 * (len(wp) - 1)
    band_type += 1
    if wp[0] >= ws[0]:
        band_type += 1

    btype = {1: 'lowpass', 2: 'highpass',
             3: 'bandstop', 4: 'bandpass'}[band_type]

    N, Wn = ordfunc(wp, ws, gpass, gstop, analog=analog)
    return iirfilter(N, Wn, rp=gpass, rs=gstop, analog=analog, btype=btype,
                     ftype=ftype, output=output)
Complete IIR digital and analog filter design.
dataset/ETHPy150Open scipy/scipy/scipy/signal/filter_design.py/iirdesign