def trace(c, starttime=None, endtime=None):
    """
    Extract a sequence of events from a cascade between a starting time
    (included) and an ending time (excluded)
    :param c: The cascade
    :param starttime: The starting time
    :param endtime: The ending time
    :return:
    """
    if starttime is None:
        return c[c < endtime]
    elif endtime is None:
        return c[c >= starttime]

    return c[(c >= starttime) & (c < endtime)]