def iflatten(x):
    """iflatten(sequence) -> iterator

    Similar to ``.flatten()``, but returns iterator instead"""
    for el in x:
        if is_listlike(el):
            for el_ in iflatten(el):
                yield el_
        else:
            yield el
iflatten(sequence) -> iterator

    Similar to ``.flatten()``, but returns iterator instead
stackoverflow/venv/lib/python3.6/site-packages/scrapy/utils/python.py