code: def deep_merge(dict_one, dict_two):
      '''
      Deep merge two dicts.
      '''
      merged = dict_one.copy()
      for key, value in dict_two.items():
          # value is equivalent to dict_two[key]
          if (key in dict_one and
                  isinstance(dict_one[key], dict) and
                  isinstance(value, dict)):
              merged[key] = deep_merge(dict_one[key], value)
          elif (key in dict_one and
                isinstance(dict_one[key], list) and
                isinstance(value, list)):
              merged[key] = list(set(dict_one[key] + value))
          else:
              merged[key] = value
      return mergef deep_merge(dict_one, dict_two):
      '''
      Deep merge two dicts.
      '''
      merged = dict_one.copy()
      for key, value in dict_two.items():
          # value is equivalent to dict_two[key]
          if (key in dict_one and
                  isinstance(dict_one[key], dict) and
                  isinstance(value, dict)):
              merged[key] = deep_merge(dict_one[key], value)
          elif (key in dict_one and
                isinstance(dict_one[key], list) and
                isinstance(value, list)):
              merged[key] = list(set(dict_one[key] + value))
          else:
              merged[key] = value
      return merged
docs: Deep merge two dicts.