def write_to_hdf5( group, name, value ):

    filename = group.file.filename

    if isinstance(value,dict):
        dict_grp = group[name]
        for k, v in value.items():
            write_to_hdf5( dict_grp, k, v )
    elif isinstance( value, VariableTree):
        vtree_grp = group[name]
        for k in value.list_vars():
            write_to_hdf5( vtree_grp, k, value.get(k) )
    elif isinstance( value, np.ndarray):
        dset = group[name]
        dset[:] = value[:]
    elif isinstance( value, list):
        if len( value ) > 0:
            if isinstance( value[0], str):
                dset = group[name]
                for i,v in enumerate(value): # TODO there must be a better way
                    dset[i] = value[i]
        else:
            pass # TODO How do we handle empty lists? Do not know type
    elif value == None :
        pass # TODO really need to write None here ?
    elif isinstance( value, (np.float64,float)):
        dset = group[name]
        dset[()] = value
    elif isinstance(value,int):
        dset = group[name]
        #dset[0,] = value
        dset[()] = value
    elif isinstance(value,str):
        dset = group[name]
        dset[()] = value
        sys.stdout.flush()
    elif isinstance(value,bool):
        dset = group[name]
        dset[()] = value
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/casehandlers/hdf5case.py/write_to_hdf5/original