from typing import List
import copy


def _increase_grid_index(grid_index_: List[int], param_grid: dict):
    """Gets the next set of parameters for grid search

    Note:
        This function assumes the default ordered dictionary
        keys in Python 3.7.

    Args:
        grid_index_: Current grid index. Each element
            indicates the corresponding element in
            param_grid.
        param_grid: Parameter grid dictionary in
            Scikit-Learn style.

    Returns:
        The next grid_index.

    """
    param_names: List[str] = list(param_grid.keys())

    grid_index_ = copy.deepcopy(grid_index_)

    for i in range(len(grid_index_)):
        grid_index_[i] += 1

        if grid_index_[i] >= len(param_grid[param_names[i]]):
            grid_index_[i] = 0
        else:
            break

    return grid_index_