<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bandpass_filter(data, k, w1, w2):
 """ This function will apply a bandpass filter to data. It will be kth order and will select the band between w1 and w2. Parameters data: array, dtype=float The data you wish to filter k: number, int The order of approximation for the filter. A max value for this isdata.size/2 w1: number, float This is the lower bound for which frequencies will pass through. w2: number, float This is the upper bound for which frequencies will pass through. Returns ------- y: array, dtype=float The filtered data. """

    data = np.asarray(data)
    low_w = np.pi * 2 / w2
    high_w = np.pi * 2 / w1
    bweights = np.zeros(2 * k + 1)
    bweights[k] = (high_w - low_w) / np.pi
    j = np.arange(1, int(k) + 1)
    weights = 1 / (np.pi * j) * (sin(high_w * j) - sin(low_w * j))
    bweights[k + j] = weights
    bweights[:k] = weights[::-1]

    bweights -= bweights.mean()

    return fftconvolve(bweights, data, mode='valid')