#NEWLINE# def find( self , **kwargs ) : #NEWLINE# #INDENT# "Find a single item with attributes matching ``**kwargs``.\n\n        This isn't very efficient: it loads the entire list then filters on\n        the Python side.\n        " #NEWLINE# matches = self . findall ( ** kwargs ) #NEWLINE# num_matches = len ( matches ) #NEWLINE# if ( num_matches == 0 ) : #NEWLINE# #INDENT# msg = ( _ ( 'No %(name)s matching %(args)s.' ) % { #NEWLINE# #INDENT# 'name' : msg . resource_class . __name__ , #NEWLINE# 'args' : kwargs , #NEWLINE# #UNINDENT# } ) #NEWLINE# raise exceptions . NotFound ( msg ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( num_matches > 1 ) : #NEWLINE# #INDENT# raise exceptions . NoUniqueMatch ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return matches [ 0 ]