import itertools


def _named_parameters(**kwargs):
    """Generate named parameter dicts for parameterized test cases.

    E.g., _named_parameters(a=[0, 1], b=2) -> {'a': 0, 'b': 2}, {'a': 1, 'b': 2}
    """
    combinations = ([(k, v) for v in (vs if isinstance(vs, list) else [vs])]
                    for k, vs in kwargs.items())
    return list(map(dict, itertools.product(*combinations)))