def before_stop(events):
    # Count items until the sentinel 'stop' or the end.
    pass
