Flatten a multi-deminision list and return a iterable

    Note that dict and str will not be expanded, instead, they will be kept as a single element.

    Args:
        l (list): The list needs to be flattened

    Returns:
        A iterable of flattened list. To have a list instead use ``list(flatten(l))``

def flatten(l):
    '''Flatten a multi-deminision list and return a iterable

    Note that dict and str will not be expanded, instead, they will be kept as a single element.

    Args:
        l (list): The list needs to be flattened

    Returns:
        A iterable of flattened list. To have a list instead use ``list(flatten(l))``
    '''
    for el in l:
        # I don;t want dict to be flattened
        if isinstance(el, Iterable) and not isinstance(
                el, (str, bytes)) and not isinstance(el, dict):
            yield from flatten(el)
        else:
            yield el