def _set_coords(ds, varname):
    """Set all variables except varname to be coords."""
    if varname is None:
        return ds

    if isinstance(varname, str):
        varname = [varname]
    coord_vars = set(ds.data_vars) - set(varname)

    return ds.set_coords(coord_vars)