def get_index_list(shape, j):
    """
    index_list = get_index_list(shape, j)

    :Arguments:
        shape: a tuple
        j: an integer

    Assumes index j is from a ravelled version of an array
    with specified shape, returns the corresponding
    non-ravelled index tuple as a list.
    """

    r = range(len(shape))
    index_list = (r)

    for i in r:
        if i < len(shape):
            prodshape = prod(shape[i + 1:])
        else:
            prodshape = 0
        index_list[i] = int(floor(j / prodshape))
        if index_list[i] > shape[i]:
            raise IndexError('Requested index too large')
        j %= prodshape

    return index_list