def METHOD_NAME(waveform, baseline=0, median_kernel_size=51, max_t0_adc=100):
    """
    Estimate t0
    max t0 adc:
    maximum adc (above baseline) the wf can get to
    before assuming the wf has started
    """
    if np.amax(waveform) < max_t0_adc:
        return np.nan
    wf_med = signal.medfilt(waveform, kernel_size=median_kernel_size)
    med_diff = gaussian_filter1d(wf_med, sigma=1, order=1)
    tp05 = calc_timepoint(
        waveform,
        percentage=max_t0_adc,
        baseline=0,
        do_interp=False,
        doNorm=False)
    tp05_rel = np.int(tp05 + 1)
    thresh = 5E-5
    last_under = tp05_rel - np.argmax(med_diff[tp05_rel::-1] <= thresh)
    if last_under >= len(med_diff) - 1:
        last_under = len(med_diff) - 2
    t0 = np.interp(thresh, (med_diff[last_under], med_diff[last_under + 1]),
                   (last_under, last_under + 1))
    return t0