<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def matching_line(freq, data, tref, bin_size=1):
 """ Find the parameter of the line with frequency 'freq' in the data. Parameters freq: float Frequency of the line to find in the data. data: pycbc.types.TimeSeries Data from which the line wants to be measured. tref: float Reference time for the frequency line. bin_size: {1, float}, optional Duration of the bins the data will be divided into for averaging. Returns ------- line_model: pycbc.types.TimeSeries A timeseries containing the frequency line with the amplitude and phase measured from the data. """

    template_line = line_model(freq, data, tref=tref)
    # Measure amplitude and phase of the line in the data
    _, amp, phi = avg_inner_product(data, template_line,
                                    bin_size=bin_size)
    return line_model(freq, data, tref=tref, amp=amp, phi=phi)