def record_exchange(db, route, amount, fee, participant, status, error=None):
 assert (route.participant.id == participant.id)
 with db.get_cursor() as cursor:
  exchange_id = cursor.one(u'\n            INSERT INTO exchanges\n                   (amount, fee, participant, status, route, note)\n            VALUES (%s, %s, %s, %s, %s, %s)\n         RETURNING id\n        ', (amount, fee, participant.username, status, route.id, error))
  if (status == u'failed'):
   propagate_exchange(cursor, participant, route, error, 0)
  elif (amount < 0):
   amount -= fee
   propagate_exchange(cursor, participant, route, u'', amount)
 return exchange_id

def record_exchange ( db , route , amount , fee , participant , status , error = None ) : assert ( route . participant . id == participant . id ) with db . get_cursor ( ) as cursor : exchange_id = cursor . one ( u'\n            INSERT INTO exchanges\n                   (amount, fee, participant, status, route, note)\n            VALUES (%s, %s, %s, %s, %s, %s)\n         RETURNING id\n        ' , ( amount , fee , participant . username , status , route . id , error ) ) if ( status == u'failed' ) : propagate_exchange ( cursor , participant , route , error , 0 ) elif ( amount < 0 ) : amount -= fee propagate_exchange ( cursor , participant , route , u'' , amount ) return exchange_id
given a bunch of stuff .