def butter_bandpass(lowcut, highcut, fs, order=5): """Returns a bandpass butterworth filter.""" nyq = 0.5 * fs low = lowcut / nyq high = highcut / nyq b, a = butter(order, [low, high], btype='band') return b, a