def _get_params(func, *args, **kwargs):
    """Turn an argument list into a dictionary.

    :arg function func: A function.
    :arg list *args: Positional arguments of `func`.
    :arg dict **kwargs: Keyword arguments of `func`.

    :returns dict: Dictionary representation of `args` and `kwargs`.
    """
    params = dict(zip(func.func_code.co_varnames[:len(args)], args))
    if func.func_defaults:
        params.update(dict(zip(func.func_code.co_varnames[-len(func.
            func_defaults):], func.func_defaults)))
    params.update(kwargs)
    return params
