code: def add_reference(self, source, target, **kwargs):
          
          # Tweak keyword arguments for addReference
          addRef_kw = kwargs.copy()
          addRef_kw.setdefault("referenceClass", self.referenceClass)
          if "schema" in addRef_kw:
              del addRef_kw["schema"]
          uid = api.get_uid(target)
          rc = api.get_tool("reference_catalog")
          # throws IndexError if uid is invalid
          rc.addReference(source, uid, self.relationship, **addRef_kw)
          # link the version of the reference
          self.link_version(source, target)
docs: Add a new reference