import itertools


def _flatmap(func, *iterables):
    """Helper function that maps the given func over the iterables and then
    creates a single flat iterable from the results.
    """

    return itertools.chain.from_iterable(map(func, *iterables))