def METHOD_NAME(
    xarray_dataset: xr.Dataset, file_path: str | Path
) -> None:
    data_var_kinds = [
        xarray_dataset.data_vars[data_var].dtype.kind
        for data_var in xarray_dataset.data_vars
    ]
    coord_kinds = [
        xarray_dataset.coords[coord].dtype.kind for coord in xarray_dataset.coords
    ]
    if "c" in data_var_kinds or "c" in coord_kinds:
        # see http://xarray.pydata.org/en/stable/howdoi.html
        # for how to export complex numbers
        with warnings.catch_warnings():
            warnings.filterwarnings(
                "ignore",
                module="h5netcdf",
                message="You are writing invalid netcdf features",
                category=UserWarning,
            )
            xarray_dataset.to_netcdf(
                path=file_path, engine="h5netcdf", invalid_netcdf=True
            )
    else:
        xarray_dataset.to_netcdf(path=file_path, engine="h5netcdf")