def walkPath(nodes, path):
    """
    This function can be used to walk a tree in the form returned by the
    buildTreeUpDown function from the ndoes module, i.e. in dictionary form.
    The path must be in the form of 'LRRL', where each letter indicates which
    child-node is next (L: left, R: right). The function returns a list of
    tuples, where the first member of each tuple is the key of the node in the
    tree-dictionary, and the second member its value in the tree.
    For a tree with 5 rows, the function can be called like this:
    path = walkPath(nodes, 'LRRL')
    """
    pathValues = []
    keys = list(nodes.keys())
    head = keys[0]
    previousMove = (head, nodes[head]['value'])
    pathValues.append(previousMove)
    for mov in path:
        currentMoveIndex = nodes[previousMove[0]][mov]
        currentMoveValue = nodes[currentMoveIndex]['value']
        previousMove = (currentMoveIndex, currentMoveValue)
        pathValues.append(previousMove)
    return pathValues