You don't need to do that for a set. sets support `len()`. Also set supports `pop()`, so the code is very similar to the list one:
assert s and len(s)==1
return s.pop()
Or if you want to stay in the immutable land: assert s and len(s)==1
return tuple(s)[0]