code: def _add_rel(self, key, rel, thing, wrap):
          
          self.o.setdefault(key, {})
  
          if wrap:
              self.o[key].setdefault(rel, [])
  
          if rel not in self.o[key]:
              self.o[key][rel] = thing
              return
  
          existing = self.o[key].get(rel)
          if isinstance(existing, list):
              existing.append(thing)
              return
  
          self.o[key][rel] = [existing, thing]
docs: Adds ``thing`` to links or embedded resources.
  
          Calling code should not use this method directly and should use
          ``embed`` or ``add_link`` instead.