<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def resample_multipitch(times, frequencies, target_times):
 """Resamples multipitch time series to a new timescale. Values in ``target_times`` outside the range of ``times`` return no pitch estimate. Parameters times : np.ndarray Array of time stamps frequencies : list of np.ndarray List of np.ndarrays of frequency values target_times : np.ndarray Array of target time stamps Returns ------- frequencies_resampled : list of numpy arrays Frequency list of lists resampled to new timebase """

    if target_times.size == 0:
        return []

    if times.size == 0:
        return [np.array([])]*len(target_times)

    n_times = len(frequencies)

    # scipy's interpolate doesn't handle ragged arrays. Instead, we interpolate
    # the frequency index and then map back to the frequency values.
    # This only works because we're using a nearest neighbor interpolator!
    frequency_index = np.arange(0, n_times)

    # times are already ordered so assume_sorted=True for efficiency
    # since we're interpolating the index, fill_value is set to the first index
    # that is out of range. We handle this in the next line.
    new_frequency_index = scipy.interpolate.interp1d(
        times, frequency_index, kind='nearest', bounds_error=False,
        assume_sorted=True, fill_value=n_times)(target_times)

    # create array of frequencies plus additional empty element at the end for
    # target time stamps that are out of the interpolation range
    freq_vals = frequencies + [np.array([])]

    # map interpolated indices back to frequency values
    frequencies_resampled = [
        freq_vals[i] for i in new_frequency_index.astype(int)]

    return frequencies_resampled