import itertools


def dict_product(dicts):
    """
    from https://stackoverflow.com/questions/5228158/cartesian-product-of-a-dictionary-of-lists
    """
    return (dict(zip(dicts, x)) for x in itertools.product(*dicts.values()))