#NEWLINE# def relate_to( self , target , reltype , is_external = False ) : #NEWLINE# #INDENT# '\n        Return rId key of relationship of *reltype* to *target*, from an\n        existing relationship if there is one, otherwise a newly created one.\n        ' #NEWLINE# if is_external : #NEWLINE# #INDENT# return self . rels . get_or_add_ext_rel ( self , target ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# rel = self . rels . get_or_add ( reltype , target ) #NEWLINE# return rel . rId