#NEWLINE# def count_e2e_one_time_keys( self , user_id , device_id ) : #NEWLINE# #INDENT# ' Count the number of one time keys the server has for a device\n        Returns:\n            Dict mapping from algorithm to number of keys for that algorithm.\n        ' #NEWLINE# def _count_e2e_one_time_keys( txn ) : #NEWLINE# #INDENT# sql = 'SELECT algorithm, COUNT(key_id) FROM e2e_one_time_keys_json WHERE user_id = ? AND device_id = ? GROUP BY algorithm' #NEWLINE# txn . execute ( sql , ( user_id , device_id ) ) #NEWLINE# result = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( algorithm , key_count ) in txn . fetchall ( ) : #NEWLINE# #INDENT# result [ algorithm ] = key_count #NEWLINE# #UNINDENT# return result #NEWLINE# #UNINDENT# return self . runInteraction ( 'count_e2e_one_time_keys' , self )