def save_data(data, filename, *, group="posterior", coords=None, dims=None):
    """Save dataset as a netcdf file.

    WARNING: Only idempotent in case `data` is InferenceData

    Parameters
    ----------
    data : InferenceData, or any object accepted by `convert_to_inference_data`
        Object to be saved
    filename : str
        name or path of the file to load trace
    group : str (optional)
        In case `data` is not InferenceData, this is the group it will be saved to
    coords : dict (optional)
        See `convert_to_inference_data`
    dims : dict (optional)
        See `convert_to_inference_data`

    Returns
    -------
    str
        filename saved to

    Note
    ----
    This function is deprecated and will be removed in 0.4.
    Use `to_netcdf` instead.
    """
    warnings.warn(
        "The 'save_data' function is deprecated as of 0.3.2, use 'to_netcdf' instead",
        DeprecationWarning,
    )
    return to_netcdf(data=data, filename=filename, group=group, coords=coords, dims=dims)