#NEWLINE# def get_or_add_ext_rel( self , reltype , target_ref ) : #NEWLINE# #INDENT# '\n        Return rId of external relationship of *reltype* to *target_ref*,\n        newly added if not already present in collection.\n        ' #NEWLINE# rel = self . _get_matching ( reltype , target_ref , is_external = True ) #NEWLINE# if ( rel is None ) : #NEWLINE# #INDENT# rId = self . _next_rId #NEWLINE# rel = self . add_relationship ( target_ref , target_ref , rId , is_external = True ) #NEWLINE# #UNINDENT# return rel . rId