import itertools


def format_args(func, *args, **kwargs):
    """Render a call to the given function.  Example:
    format_args(print, 'Hello', end=' ') == "print('Hello', end=' ')"

    """
    str_args = ', '.join(itertools.chain(
        map(repr, args), (f'k={v!r}' for k, v in kwargs.items()),
    ))
    return f'{func.__qualname__}({str_args})'