from collections import Iterable

def flatten(lst):
    for each in lst:
        if not isinstance(each, Iterable) or isinstance(each, str):
            yield each
        else:
            yield from flatten(each)
        
    

