def create_rdict(d):
    """
    Return a dictionary with each key mapping to a set of values.
    """
    rd = {}
    for (key, value) in list(d.items()):
        v = rd.setdefault(value, set([]))
        v.add(key)

    return rd