def update_route_events(veh, timeind):
    """Check if the next event from a vehicle's route_events should be applied, and apply it if so.

    route_events are a list of events which handles any lane changing behavior related to
    a vehicle's route, i.e. route events ensure that the vehicle follows its route.
    Each event is a dictionary with the keys of
    'pos': the float position the event occurs (relative to the vehicle's current lane).
    'event': 'end discretionary' or 'mandatory', which end discretionary or start mandatory
        lane changing states
    'side': 'l_lc' or 'r_lc' the side which is updated by the event
    'lc_urgency': only for a 'mandatory' event, a tuple giving the position for 0% and 100% forced cooperation

    Args:
        veh: Vehicle object to update

    Returns:
        bool: True if we made a change, to the route, False otherwise
    """
    if not veh.route_events:
        return False
    curevent = veh.route_events[0]
    if veh.pos > curevent['pos']:

        if curevent['event'] == 'end discretionary':
            side = curevent['side']
            setattr(veh, side, None)
            veh.update_lc_state(timeind)

        elif curevent['event'] == 'mandatory':
            setattr(veh, curevent['side'], 'mandatory')
            veh.lc_urgency = curevent['lc_urgency']  # must always set urgency for mandatory changes
            veh.update_lc_state(timeind)

        veh.route_events.pop(0)
        return True
    return False