def to_rawtx(tx):
if tx.get('<STR_LIT>'):<EOL><INDENT>return tx['<STR_LIT>']<EOL><DEDENT>new_tx = {}<EOL>locktime = tx.get('<STR_LIT>', <NUM_LIT:0>)<EOL>new_tx['<STR_LIT>'] = locktime<EOL>new_tx['<STR_LIT:version>'] = tx.get('<STR_LIT:version>', <NUM_LIT:1>)<EOL>new_tx['<STR_LIT>'] = [<EOL>{<EOL>'<STR_LIT>': {'<STR_LIT>': str(x['<STR_LIT>']), '<STR_LIT:index>': x['<STR_LIT:n>']},<EOL>'<STR_LIT>': str(x['<STR_LIT>'].replace('<STR_LIT:U+0020>', '<STR_LIT>')),<EOL>'<STR_LIT>': x.get('<STR_LIT>', <NUM_LIT> if locktime == <NUM_LIT:0> else None)<EOL>} for x in tx['<STR_LIT>']<EOL>]<EOL>new_tx['<STR_LIT>'] = [<EOL>{<EOL>'<STR_LIT>': str(x['<STR_LIT>']),<EOL>'<STR_LIT:value>': x['<STR_LIT>']<EOL>} for x in tx['<STR_LIT>']<EOL>]<EOL>return serialize(new_tx)<EOL>
Take a tx object in the moneywagon format and convert it to the format
that pybitcointools's `serialize` funcion takes, then return in raw hex
format.