def merge_policies_dict(non_report_only_policies_dict, report_only_policies_dict):
 if ((non_report_only_policies_dict is None) or (len(non_report_only_policies_dict) == 0)):
  return report_only_policies_dict
 if ((report_only_policies_dict is None) or (len(report_only_policies_dict) == 0)):
  return non_report_only_policies_dict
 merged_policies = {}
 directives_names = list(set((non_report_only_policies_dict.keys() + report_only_policies_dict.keys())))
 for k in directives_names:
  values = []
  if (k in non_report_only_policies_dict):
   values.extend(non_report_only_policies_dict[k])
  if (k in report_only_policies_dict):
   values.extend(report_only_policies_dict[k])
  merged_policies[k] = list(set(values))
 return merged_policies

def merge_policies_dict ( non_report_only_policies_dict , report_only_policies_dict ) : if ( ( non_report_only_policies_dict is None ) or ( len ( non_report_only_policies_dict ) == 0 ) ) : return report_only_policies_dict if ( ( report_only_policies_dict is None ) or ( len ( report_only_policies_dict ) == 0 ) ) : return non_report_only_policies_dict merged_policies = { } directives_names = list ( set ( ( non_report_only_policies_dict . keys ( ) + report_only_policies_dict . keys ( ) ) ) ) for k in directives_names : values = [ ] if ( k in non_report_only_policies_dict ) : values . extend ( non_report_only_policies_dict [ k ] ) if ( k in report_only_policies_dict ) : values . extend ( report_only_policies_dict [ k ] ) merged_policies [ k ] = list ( set ( values ) ) return merged_policies
method to merge 2 policies dictionaries to a single .