def sort_set(s):
    if not isinstance(s, Set):
        raise TypeError("sets only")
    s = frozenset(s)
    if s not in _sort_set_memo:
        _sort_set_memo[s] = sorted(s, key=_sort_set_key)
    return _sort_set_memo[s]