def _SetNDListValue(ndList, ndims, indexList, value):
    """Set a value in the ndList, equivalent to ndList[indexList[0]][indexList[1]]... """
    assert len(indexList) == ndims
    l = ndList
    for i in indexList[:-1]:
        l = l[i]
    l[indexList[-1]] = value
