#NEWLINE# def _metadata_query( self , query_type , any_query_type , kv ) : #NEWLINE# #INDENT# 'Helper function returns a query object that will find items\n        according to the library query type provided and the key-value\n        pairs specified. The any_query_type is used for queries of\n        type "any"; if None, then an error is thrown.\n        ' #NEWLINE# if kv : #NEWLINE# #INDENT# queries = [ ] #NEWLINE# it = iter ( kv ) #NEWLINE# for ( tag , value ) in zip ( it , it ) : #NEWLINE# #INDENT# if ( tag . lower ( ) == 'any' ) : #NEWLINE# #INDENT# if any_query_type : #NEWLINE# #INDENT# queries . append ( any_query_type ( value , ITEM_KEYS_WRITABLE , query_type ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise BPDError ( ERROR_UNKNOWN , 'no such tagtype' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ( _ , key ) = self . _tagtype_lookup ( tag ) #NEWLINE# queries . append ( query_type ( key , value ) ) #NEWLINE# #UNINDENT# #UNINDENT# return dbcore . query . AndQuery ( queries ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return dbcore . query . TrueQuery ( )