import itertools


def get_permutations(dict_a, dict_b):
    """
    Receives a dict_a containing all configuration the model needs, and a dict_b containing the
    keys that need to be part of the cross validation. Then it generates all the configuration permutations
    fully by merging dict_a with every permutation of dict_b
    :param dict_a:
    :param dict_b:
    :return:
    """
    values = list(dict_b.values())
    keys = list(dict_b.keys())
    permuted_individual_values = list(itertools.product(*values))
    permutations = []
    for individual in permuted_individual_values:
        permutation = dict_a.copy()
        for idx in range(len(keys)):
            permutation[keys[idx]] = individual[idx]
        permutations.append(permutation)

    return permutations