def flatten(obj):
    """
    >>> list(flatten([1, 2]))
    [1, 2]
    >>> list(flatten([[1, [2, 3]], 4]))
    [1, 2, 3, 4]

    >>> list(flatten([xrange(1, 3), xrange(3, 5)]))
    [1, 2, 3, 4]

    >>> list(flatten(list))
    []
    """

    queue = collections.deque([obj])
    while queue:
        obj = queue.popleft()

        if callable(obj):
            queue.appendleft(obj())
            continue

        try:
            iterable = iter(obj)
        except __HOLE__:
            yield obj
        else:
            queue.extendleft(reversed(list(iterable)))
dataset/ETHPy150Open abusesa/abusehelper/abusehelper/core/config.py/flatten