(sequence, test_func)
Tests test_func on all items of sequence and items of included
    sub-iterables
Tests test_func on all items of sequence and items of included
    sub-iterables
Tests test_func on all items of sequence and items of included sub - iterables
def rec_test(sequence, test_func):
    """Tests test_func on all items of sequence and items of included
    sub-iterables"""
    for x in sequence:
        if isinstance(x, (list, tuple)):
            yield from rec_test(x, test_func)
        else:
            yield test_func(x)
def rec_test ( sequence , test_func ) : for x in sequence : if isinstance ( x , ( list , tuple ) ) : yield from rec_test ( x , test_func ) else : yield test_func ( x )