@py2_compatible<EOL>def imap_yield(func, gen):
gen = iter(gen)<EOL>assert _is_just_started(gen)<EOL>yielder = yield_from(gen)<EOL>for item in yielder:<EOL><INDENT>with yielder:<EOL><INDENT>yielder.send((yield func(item)))<EOL><DEDENT><DEDENT>return_(yielder.result)<EOL>
Apply a function to all ``yield`` values of a generator

    Parameters
    ----------
    func: ~typing.Callable[[T_yield], T_mapped]
        the function to apply
    gen: Generable[T_yield, T_send, T_return]
        the generator iterable.

    Returns
    -------
    ~typing.Generator[T_mapped, T_send, T_return]
        the mapped generator