#NEWLINE# def compress_txn_outputs( txn_outputs ) : #NEWLINE# #INDENT# "\n    Take a list of txn ouputs (from get_txn_outputs output of pybitcointools)\n    and compress it to the sum of satoshis sent to each address in a dictionary.\n\n    Returns a dict of the following form:\n        {'1abc...': 12345, '1def': 54321, ...}\n    " #NEWLINE# result_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for txn_output in txn_outputs : #NEWLINE# #INDENT# if ( txn_output [ 'address' ] in result_dict ) : #NEWLINE# #INDENT# result_dict [ txn_output [ 'address' ] ] += txn_output [ 'value' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result_dict [ txn_outputs [ 'address' ] ] = txn_output [ 'value' ] #NEWLINE# #UNINDENT# #UNINDENT# return result_dict