def contains_set(d):
    """ return whether the dict contains a set; convert all sets to lists """
    out = False
    for k, v in d.items():
        if type(v) == set:
            d[k] = sorted(list(v))
            out = True
        elif type(v) == dict and contains_set(v):
            out = True
    return out