code: def merge_attributes(attr1, attr2):
      
  
      new_d = copy.deepcopy(attr1)
      new_d.update(attr2)
  
      #all of attr2 key : values just overwrote attr1, fix it
      for k, v in new_d.items():
          if not isinstance(v, list):
              new_d[k] = [v]
  
      for k, v in six.iteritems(attr1):
          if k in attr2:
              if not isinstance(v, list):
                  v = [v]
              new_d[k].extend(v)
      return dict((k, sorted(set(v))) for k, v in new_d.items())
docs: Merges two attribute dictionaries into a single dictionary.
  
      Parameters
      ----------
      `attr1`, `attr2` : dict
  
      Returns
      -------
      dict