def band_pass_and_downsample(data, sampling_frequency, low_frequency):
    """
    Band pass and down sample the input data with high pass frequency
    `low_frequency` and new sampling rate `sampling_frequency`.

    Parameters
    ----------
    data: gwpy.timeseries.TimeSeries
        Input time series data
    sampling_frequency: float
        The sampling frequency after down sampling.
    low_frequency: float
        The high pass frequency

    Returns
    -------
    resampled: gwpy.timeseries.TimeSeries
        Result of band passing and down sampling.
    """
    high_frequency = sampling_frequency // 2
    if low_frequency > 0:
        high_passed = data.highpass(low_frequency)
    else:
        high_passed = data.copy()
    if high_frequency < sampling_frequency / 2:
        low_passed = high_passed.lowpass(high_frequency)
    else:
        low_passed = high_passed.copy()
    if sampling_frequency < low_passed.sample_rate.value:
        resampled = low_passed.resample(sampling_frequency)
    else:
        resampled = low_passed.copy()
    return resampled