#NEWLINE# def extract_item_data( deal ) : #NEWLINE# #INDENT# 'Separate deal and merchant data.' #NEWLINE# merchant = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for field in MERCHANT_FIELDS : #NEWLINE# #INDENT# if ( field in deal ) : #NEWLINE# #INDENT# merchant [ field . replace ( 'merchant_' , '' ) ] = deal [ field ] #NEWLINE# del deal [ field ] #NEWLINE# #UNINDENT# #UNINDENT# if ( 'merchant_city' in deal ) : #NEWLINE# #INDENT# del deal [ 'merchant_city' ] #NEWLINE# #UNINDENT# deal [ 'date_time' ] = tz . now ( ) #NEWLINE# return ( deal , merchant )