def METHOD_NAME(ms_lib, symbol):
    # Lower level checks to ensure end_time is set correctly
    start_time = 'start'
    metadata = None
    for item in ms_lib.find({'symbol': symbol}, sort=[('start_time', 1)]):
        if start_time != 'start' and item['start_time'] != start_time:
            raise ValueError('end_time not set correctly')
        start_time = item.get('end_time')
        if item['metadata'] == metadata:
            raise ValueError('consecutive duplicate metadata')
        metadata = item['metadata']
    assert start_time == None, 'end_time of the last entry should be unset'