import itertools


def _create_dense_state_space_grid(optim_paras):
    """Create a grid of dense variables.

    The function loops through all potential realizations of each dense dimension and
    returns a list of all possible joint realizations of dense variables.

    Parameters
    ----------
    optim_paras : dict
        Contains parsed model parameters.

    Returns
    -------
    dense_state_space_grid : list
        Contains all dense states as tuples.

    """
    levels_of_observables = [range(len(i)) for i in optim_paras["observables"].values()]
    types = [range(optim_paras["n_types"])] if optim_paras["n_types"] >= 2 else []

    dense_state_space_grid = list(itertools.product(*levels_of_observables, *types))
    if dense_state_space_grid == [()]:
        dense_state_space_grid = False

    return dense_state_space_grid