#NEWLINE# def _get_by_ref_or_id( self , ref_or_id , exclude_fields = None ) : #NEWLINE# #INDENT# '\n        Retrieve resource object by an id of a reference.\n\n        Note: This method throws StackStormDBObjectNotFoundError exception if the object is not\n        found in the database.\n        ' #NEWLINE# if ResourceReference . is_resource_reference ( ref_or_id ) : #NEWLINE# #INDENT# is_reference = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# is_reference = False #NEWLINE# #UNINDENT# if is_reference : #NEWLINE# #INDENT# resource_db = self . _get_by_ref ( resource_ref = ref_or_id , exclude_fields = exclude_fields ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# resource_db = self . _get_by_id ( resource_id = ref_or_id , exclude_fields = exclude_fields ) #NEWLINE# #UNINDENT# if ( not resource_db ) : #NEWLINE# #INDENT# msg = ( 'Resource with a reference or id "%s" not found' % ref_or_id ) #NEWLINE# raise StackStormDBObjectNotFoundError ( msg ) #NEWLINE# #UNINDENT# return resource_db