def make_doublebang_pulse_fun(parameters, tf):
    """Return double-bang pulse function.

    y0, t1, y1 = parameters

    For 0 <= t <= t1, constant height y0.
    For t >= t1, constant height y1.
    """
    y0, t1, y1 = parameters
    def fun(t, *args):
        if 0 <= t <= t1:
            return y0
        elif t1 < t <= tf:
            return y1
        else:
            return 200.
    return fun