def write_hdf5_dict(tsdict, h5f, group=None, **kwargs):
    """Write a `TimeSeriesBaseDict` to HDF5

    Each series in the dict is written as a dataset in the group
    """
    # create group if needed
    if group and group not in h5f:
        h5g = h5f.create_group(group)
    elif group:
        h5g = h5f[group]
    else:
        h5g = h5f

    # write each timeseries
    kwargs.setdefault('format', 'hdf5')
    for key, series in tsdict.items():
        series.write(h5g, path=str(key), **kwargs)
Write a `TimeSeriesBaseDict` to HDF5

    Each series in the dict is written as a dataset in the group