import itertools


def _parse_param_grid(grid):
    """Parse param grid to a list of all possible params combination.

    Args:
        grid (dict): (param name: list of value).

    Returns:
        res (list): dictionary of params.
    """

    items = sorted(grid.items())
    keys, values = zip(*items)
    res = []
    for v in itertools.product(*values):
        params = dict(zip(keys, v))
        res.append(params)
    return res