def bws(t: int, tstart: int, tend: int, alpha: int) -> float:
    """Bounded-window scheduling function.

    This function returns 1.0 for `t <= tstart`, 0.0 for `tend <= t`, and
    `\lambda^{\alpha}` for `tstart < t < tend`, where `\lambda =
    \frac{tend - t}{tend - tstart}`.
    """

    # assert 0 <= tstart < tend
    # assert 0 <= alpha

    t          = min(max(t, tstart), tend)
    multiplier = (float(tend - t) / float(tend - tstart)) ** alpha

    return multiplier