

def flatten(item):
    if hasattr(item, '__iter__'):
        for i in iter(item):
            for j in flatten(i):
                (yield j)
    else:
        (yield item)

dataset/ETHPy150Open NervanaSystems/neon/neon/layers/container.py flatten/original