from typing import Callable
from typing import Iterable


def multiply(func: Callable, *args, **kwargs):
    """
    Returns a function that takes an iterable and maps ``func`` over it.
    Useful when multiple batches require the same function.

    ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.
    """

    def wrapped(xs: Iterable, *args_, **kwargs_) -> tuple:
        return tuple(func(x, *args_, *args, **kwargs_, **kwargs) for x in xs)

    return wrapped