code: def get_or_add_ext_rel(self, reltype, target_ref):
          
          rel = self._get_matching(reltype, target_ref, is_external=True)
          if rel is None:
              rId = self._next_rId
              rel = self.add_relationship(
                  reltype, target_ref, rId, is_external=True
              )
          return rel.rId
docs: Return rId of external relationship of *reltype* to *target_ref*,
          newly added if not already present in collection.