def random_choice(sequence):
    """ Same as :meth:`random.choice`, but also supports :class:`set` type to be passed as sequence. """
    return random.choice(tuple(sequence) if isinstance(sequence, set) else sequence)
Same as :meth:`random.choice`, but also supports :class:`set` type to be passed as sequence.