def blacklist(d, fields):
    """Blacklists a dictionary by keeping all EXCEPT the selected `fields`.
    Non-destructive (creates and returns a new dict)."""
    ret = type(d)()
    fields = set(fields)
    for k, v in d.iteritems():
        if k not in fields:
            ret[k] = v
    return ret