def load_dict_of_nested_lists_from_h5(fname, toplevelkeys=None):
<EOL>data = {}<EOL>f = h5py.File(fname, '<STR_LIT:r>')<EOL>if toplevelkeys is not None:<EOL><INDENT>for i in toplevelkeys:<EOL><INDENT>ivalue = f[str(i)]<EOL>data[i] = []<EOL>for j, jvalue in enumerate(ivalue.values()):<EOL><INDENT>data[int(i)].append([])<EOL>for k, kvalue in enumerate(jvalue.values()):<EOL><INDENT>data[i][j].append(kvalue.value)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for i, ivalue in list(f.items()):<EOL><INDENT>i = int(i)<EOL>data[i] = []<EOL>for j, jvalue in enumerate(ivalue.values()):<EOL><INDENT>data[i].append([])<EOL>for k, kvalue in enumerate(jvalue.values()):<EOL><INDENT>data[i][j].append(kvalue.value)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>f.close()<EOL>return data<EOL>
Load nested list structure from hdf5 file


Parameters
----------        
fname : str
    Filename
toplevelkeys : None or iterable, 
    Load a two(default) or three-layered structure.


Returns
-------
dict(list(numpy.ndarray))
    dictionary of nested lists with variable length array data.