def _append(lst, indices, value):
    """Adds `value` to `lst` list indexed by `indices`. Will create sub lists as required.
    """
    for i, idx in enumerate(indices):
        while len(lst) <= idx:
            lst.append([])
        lst = lst[idx]
    lst.append(value)
