def METHOD_NAME(ds, fileName, fillValues=netCDF4.default_fillvals):
    encodingDict = {}
    variableNames = list(ds.data_vars.keys()) + list(ds.coords.keys())
    for variableName in variableNames:
        dtype = ds[variableName].dtype
        for fillType in fillValues:
            if dtype == numpy.dtype(fillType):
                encodingDict[variableName] = \
                    {'_FillValue': fillValues[fillType]}
                break
    delayed_obj = ds.to_netcdf(fileName, encoding=encodingDict, compute=False)
    print('Writing {}'.format(fileName))
    with ProgressBar():
        delayed_obj.compute()