# Copyright (c) Microsoft Corporation.# Licensed under the MIT license.fromtypingimportList,Union
[docs]defcombine_dict(existing_dict:dict=None,new_dict:dict=None)->dict:""" Combines two dictionaries containing string keys and values into one. Args: existing_dict: Dictionary with existing values new_dict: Dictionary with new values to be added to the existing dictionary. Note if there's a key clash, the value in new_dict will be used. Returns: dict: combined dictionary """result={**(existing_dictor{})}result.update(new_dictor{})returnresult
[docs]defcombine_list(list1:Union[str,List[str]],list2:Union[str,List[str]])->list:""" Combines two lists containing string keys, keeping only unique values. Args: existing_dict: Dictionary with existing values new_dict: Dictionary with new values to be added to the existing dictionary. Note if there's a key clash, the value in new_dict will be used. Returns: list: combined dictionary """ifisinstance(list1,str):list1=[list1]ifisinstance(list2,str):list2=[list2]# Merge and keep only unique valuescombined=list(set(list1+list2))returncombined