<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def logarithmic_interpolation_extrapolation(df, target_height):
 r""" Logarithmic inter- or extrapolates between the values of a data frame. This function can be used for the inter-/extrapolation of the wind speed if it is available at two or more different heights, to approximate the value at hub height. The function is carried out when the parameter `wind_speed_model` :class:`~.modelchain.ModelChain` class is 'log_interpolation_extrapolation'. Parameters df : pandas.DataFrame DataFrame with time series for parameter that is to be interpolated or extrapolated. The columns of the DataFrame are the different heights for which the parameter is available. If more than two heights are given, the two closest heights are used. See example in :py:func:`~.linear_interpolation_extrapolation` on how the DataFrame should look like and how the function can be used. target_height : float Height for which the parameter is approximated (e.g. hub height). Returns ------- pandas.Series Result of the inter-/extrapolation (e.g. wind speed at hub height). Notes ----- For the logarithmic inter- and extrapolation the following equation is used [1]_: .. math:: f(x) = \frac{\ln(x) \cdot (f(x_2) - f(x_1)) - f(x_2) \cdot \ln(x_1) + f(x_1) \cdot \ln(x_2)}{\ln(x_2) - \ln(x_1)} References .. [1] Knorr, K.: "Modellierung von raum-zeitlichen Eigenschaften der Windenergieeinspeisung für wetterdatenbasierte Windleistungssimulationen". Universität Kassel, Diss., 2016, p. 83 """

    # find closest heights
    heights_sorted = df.columns[
        sorted(range(len(df.columns)),
               key=lambda i: abs(df.columns[i] - target_height))]
    return ((np.log(target_height) *
             (df[heights_sorted[1]] - df[heights_sorted[0]]) -
             df[heights_sorted[1]] * np.log(heights_sorted[0]) +
             df[heights_sorted[0]] * np.log(heights_sorted[1])) /
            (np.log(heights_sorted[1]) - np.log(heights_sorted[0])))