import copy


def nextAction(state) :
    """Returns the state at the next action
    """
    newState = copy.deepcopy(state)
    # Updates the timeline to be at the next action, i.e. the action with the 
    # lowest timestamp in the list of next actions
    newState['timeline']['currentAction'] = newState['timeline']['nextActions'][0][1]
    newState['timeline']['timestamp'] = newState['timeline']['nextActions'][0][0]
    newState['timeline']['nextActions'] = newState['timeline']['nextActions'][1::]
    return newState