def _hdf_write(h5, data, name="data", group="/datasets"):
    import tables
    atom = tables.Atom.from_dtype(data.dtype)
    filt = tables.filters.Filters(complevel=9, complib='blosc', shuffle=True)
    create = False
    try:
        ds = h5.getNode("%s/%s"%(group, name))
        ds[:] = data
    except tables.NoSuchNodeError:
        create = True
    except __HOLE__:
        h5.removeNode("%s/%s"%(group, name))
        create = True

    if create:
        ds = h5.createCArray(group, name, atom, data.shape, filters=filt, createparents=True)
        ds[:] = data
        
    return ds
dataset/ETHPy150Open gallantlab/pycortex/cortex/dataset.py/_hdf_write