def get_array_sizes(list, name):
    t_list = []

    if len(list) == 1:
        for t in range(0, list[0]):
            t_list.append(name + "[%s]" % t)
    elif len(list) == 2:
        for t1 in range(0, list[0]):
            for t2 in range(0, list[1]):
                    t_list.append(name + "[%s][%s]" % (t1, t2))
    elif len(list) == 3:
        for t1 in range(0, list[0]):
            for t2 in range(0, list[1]):
                for t3 in range(0, list[2]):
                    t_list.append(name + "[%s][%s][%s]" % (t1, t2, t3))

    return t_list
Expand the elements of an array for 1, 2, and 3D arrays
dataset/ETHPy150Open rca/PySPICE/mkwrapper.py/get_array_sizes