from operator import concat


def mapcat(iteratee, *seqs):
    """
    Map an `iteratee` to each element of each iterable in `seqs` and concatenate the results into a
    single iterable.

    Examples:
        >>> list(mapcat(lambda x: list(range(x)), range(4)))
        [0, 0, 1, 0, 1, 2]

    Args:
        iteratee (object): Iteratee to apply to each element.
        *seqs (Iterable): Iterable to map and concatenate.

    Yields:
        Elements resulting from concat + map operations.
    """
    return concat(*map(iteratee, *seqs))