import copy


def JoinDictionariesLists(starting_dict, dominant_dict):
    """ takes the starting_dict and add to it the dominant_dict items
    if values types are different, it saves the dominant value.
    list values are combined.
    dict values are recursive joined by this function.
    :param starting_dict: the starting dict
    :param dominant_dict: the dominant dictionary, if values types are different it saves this dictionary value.
    :return: A combined dictionary of the two.
    """
    result_dic = copy.deepcopy(starting_dict)
    for key in dominant_dict:
        value2 = dominant_dict[key]
        if key in result_dic:
            value1 = result_dic[key]
            type_value1 = type(value1)
            type_value2 = type(value2)
            if type_value1 == type_value2:
                if type_value1 is list:
                    result_dic[key] = value1 + value2
                if type_value1 is str:
                    result_dic[key] = value2
                if type_value1 is dict:
                    result_dic[key] = JoinDictionariesLists(value1, value2)
            else:
                result_dic[key] = value2
        else:
            result_dic[key] = value2
    return result_dic