async def serialize_archive(self, ar, version=None):
<EOL>await ar.message(self, TransactionPrefix)<EOL>if self.version == <NUM_LIT:1>:<EOL><INDENT>await ar.tag('<STR_LIT>')<EOL>await ar.begin_array()<EOL>await ar.prepare_container(len(self.vin), eref(self, '<STR_LIT>'), elem_type=SignatureArray)<EOL>signatures_not_expected = len(self.signatures) == <NUM_LIT:0><EOL>if not signatures_not_expected and len(self.vin) != len(self.signatures):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>for i in range(len(self.vin)):<EOL><INDENT>sig_size = get_signature_size(self.vin[i])<EOL>if signatures_not_expected:<EOL><INDENT>if <NUM_LIT:0> == sig_size:<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>await ar.prepare_container(sig_size, eref(self.signatures, i), elem_type=SignatureArray)<EOL>if sig_size != len(self.signatures[i]):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>for j in range(sig_size):<EOL><INDENT>await ar.field(eref(self.signatures[i], j), Signature)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>await ar.tag('<STR_LIT>')<EOL>if len(self.vin) == <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>await ar.begin_object()<EOL>await ar.prepare_message(eref(self, '<STR_LIT>'), RctSig)<EOL>await self.rct_signatures.serialize_rctsig_base(ar, len(self.vin), len(self.vout))<EOL>await ar.end_object()<EOL>if self.rct_signatures.type != RctType.Null:<EOL><INDENT>mixin_size = len(self.vin[<NUM_LIT:0>].key_offsets) - <NUM_LIT:1> if len(self.vin) > <NUM_LIT:0> and isinstance(self.vin[<NUM_LIT:0>], TxinToKey) else <NUM_LIT:0><EOL>await ar.tag('<STR_LIT>')<EOL>await ar.begin_object()<EOL>await ar.prepare_message(eref(self.rct_signatures, '<STR_LIT:p>'), RctSigPrunable)<EOL>await self.rct_signatures.p.serialize_rctsig_prunable(ar, self.rct_signatures.type,<EOL>len(self.vin), len(self.vout),<EOL>mixin_size)<EOL>await ar.end_object()<EOL><DEDENT><DEDENT>return self<EOL>
Serialize the transaction
:param ar:
:type ar: x.Archive
:return: