from typing import Callable
from typing import Iterable
from typing import Any


def with_args(create_args: Callable[[], Iterable[Any]]):
    """
    Decorator factory, adds given extra arguments to the decorated function.
    :param create_args: function to create arguments with.
    :return: Decorator.
    """
    def runner(fn):
        # this wraps the function, to hide that the function actually yielding data.
        def entry(*args, **kw):
            return fn(*(list(create_args()) + list(args)), **kw)
        return entry
    return runner