from functools import reduce


def traverse(container, path):
    """
    Return the node at ``path`` in the nested ``container``

    >>> traverse([34, {'hello': [['a', 'b'], ['c', 'd']], 'world': 42}], [0])
    34
    >>> traverse([34, {'hello': [['a', 'b'], ['c', 'd']], 'world': 42}], [1, 'world'])
    42
    >>> traverse([34, {'hello': [['a', 'b'], ['c', 'd']], 'world': 42}], [1, 'hello', 1, 0])
    'c'
    """
    try:
        return reduce(lambda cur_node, pathcomp: cur_node[pathcomp], path, container)
    except (KeyError, IndexError):
        raise ValueError("Invalid path for container")