#NEWLINE# def get_related_resource( self , related_instance ) : #NEWLINE# #INDENT# '\n        Instaniates the related resource.\n        ' #NEWLINE# related_class = type ( related_instance ) #NEWLINE# if ( related_class in self . _rel_resources ) : #NEWLINE# #INDENT# return self . _rel_resources [ related_class ] #NEWLINE# #UNINDENT# related_resource = self . to_class ( ) #NEWLINE# if ( related_resource . _meta . api_name is None ) : #NEWLINE# #INDENT# if ( self . _resource and ( self . _resource . _meta . api_name is not None ) ) : #NEWLINE# #INDENT# related_resource . _meta . api_name = self . _resource . _meta . api_name #NEWLINE# #UNINDENT# #UNINDENT# self . _rel_resources [ related_class ] = related_resource #NEWLINE# return related_resource