def flatten(suitable_for_isinstance):
    """
    isinstance() can accept a bunch of really annoying different types:
        * a single type
        * a tuple of types
        * an arbitrary nested tree of tuples

    Return a flattened tuple of the given argument.

    """

    types = set()

    if not isinstance(suitable_for_isinstance, tuple):
        suitable_for_isinstance = (suitable_for_isinstance,)
    for thing in suitable_for_isinstance:
        if isinstance(thing, tuple):
            types.update(flatten(thing))
        else:
            types.add(thing)
    return tuple(types)
def flatten ( suitable_for_isinstance ) : types = set ( ) if not isinstance ( suitable_for_isinstance , tuple ) : suitable_for_isinstance = ( suitable_for_isinstance , ) for thing in suitable_for_isinstance : if isinstance ( thing , tuple ) : types . update ( flatten ( thing ) ) else : types . add ( thing ) return tuple ( types )
isinstance() can accept a bunch of really annoying different types:
        * a single type
        * a tuple of types
        * an arbitrary nested tree of tuples

    Return a flattened tuple of the given argument.