Serialize the transaction
        :param ar:
        :type ar: x.Archive
        :return:
192764
async def serialize_archive(self, ar, version=None):
        
        # Transaction prefix serialization first.
        await ar.message(self, TransactionPrefix)

        if self.version == 1:
            await ar.tag('signatures')
            await ar.begin_array()
            await ar.prepare_container(len(self.vin), eref(self, 'signatures'), elem_type=SignatureArray)
            signatures_not_expected = len(self.signatures) == 0
            if not signatures_not_expected and len(self.vin) != len(self.signatures):
                raise ValueError('Signature size mismatch')

            for i in range(len(self.vin)):
                sig_size = get_signature_size(self.vin[i])
                if signatures_not_expected:
                    if 0 == sig_size:
                        continue
                    else:
                        raise ValueError('Unexpected sig')

                await ar.prepare_container(sig_size, eref(self.signatures, i), elem_type=SignatureArray)
                if sig_size != len(self.signatures[i]):
                    raise ValueError('Unexpected sig size')

                for j in range(sig_size):
                    await ar.field(eref(self.signatures[i], j), Signature)

        else:
            await ar.tag('rct_signatures')
            if len(self.vin) == 0:
                return

            await ar.begin_object()
            await ar.prepare_message(eref(self, 'rct_signatures'), RctSig)
            await self.rct_signatures.serialize_rctsig_base(ar, len(self.vin), len(self.vout))
            await ar.end_object()

            if self.rct_signatures.type != RctType.Null:
                mixin_size = len(self.vin[0].key_offsets) - 1 if len(self.vin) > 0 and isinstance(self.vin[0], TxinToKey) else 0
                await ar.tag('rctsig_prunable')
                await ar.begin_object()
                await ar.prepare_message(eref(self.rct_signatures, 'p'), RctSigPrunable)
                await self.rct_signatures.p.serialize_rctsig_prunable(ar, self.rct_signatures.type,
                                                                      len(self.vin), len(self.vout),
                                                                      mixin_size)
                await ar.end_object()
        return self
968424
public function serialize(): void
    {
        $dag = $this->transaction['asset']['ipfs']['dag'];

        $this->buffer->writeUInt8(strlen($dag) / 2);
        $this->buffer->writeHexBytes($dag);
    }
1033951
def serialize(self):
        

        self.data = bytearray()
        r = self.protocols[::-1]
        for i, p in enumerate(r):
            if isinstance(p, packet_base.PacketBase):
                if i == len(r) - 1:
                    prev = None
                else:
                    prev = r[i + 1]
                data = p.serialize(self.data, prev)
            else:
                data = six.binary_type(p)
            self.data = bytearray(data + self.data)
819034
def SerializeExclusiveDataAlternative(self, writer):
        
        byt = int.to_bytes(self.Nonce, 4, 'little')
        ba = bytearray(byt)
        byts = binascii.hexlify(ba)
        writer.WriteBytes(byts)
695761
async def tuple(self, elem=None, elem_type=None, params=None):
        
        if hasattr(elem_type, "serialize_archive"):
            container = elem_type() if elem is None else elem
            return await container.serialize_archive(
                self, elem=elem, elem_type=elem_type, params=params
            )

        if self.writing:
            return await self._dump_tuple(self.iobj, elem, elem_type, params)
        else:
            return await self._load_tuple(
                self.iobj, elem_type, params=params, elem=elem
            )
583454
def serialize(self, cls, record):
        
        return json.dumps(record, cls=self.encoder)
1150475
function ( ar ) {
		var obj = {},
		    i   = ar.length;

		while ( i-- ) {
			obj[i.toString()] = ar[i];
		}

		return obj;
	}
1127380
def serialize_m2m_on_save(sender, action, instance, using, **kwargs):
    
    if action == "post_add":
        try:
            wrapped_instance = site_offline_models.get_wrapped_instance(instance)
        except ModelNotRegistered:
            pass
        else:
            wrapped_instance.to_outgoing_transaction(using, created=True)
1057628
def archive(self):
        

        self._client._put(
            "{0}/archived".format(
                self.__class__.base_url(
                    self.sys['space'].id,
                    self.sys['id'],
                    environment_id=self._environment_id
                ),
            ),
            {},
            headers=self._update_headers()
        )

        return self.reload()
72504
def btc_tx_serialize(_txobj):
    
    
    # output buffer
    o = []
    txobj = None
    if encoding.json_is_base(_txobj, 16):
        # txobj is built from hex strings already.  deserialize them 
        txobj = encoding.json_changebase(_txobj, lambda x: binascii.unhexlify(x))
    else:
        txobj = copy.deepcopy(_txobj)

    # version
    o.append(encoding.encode(txobj["version"], 256, 4)[::-1])

    # do we have any witness scripts?
    have_witness = False
    for inp in txobj['ins']:
        if inp.has_key('witness_script') and len(inp['witness_script']) > 0:
            have_witness = True
            break

    if have_witness:
        # add segwit marker 
        o.append('\x00\x01')
    
    # number of inputs
    o.append(encoding.num_to_var_int(len(txobj["ins"])))

    # all inputs
    for inp in txobj["ins"]:
        # input tx hash
        o.append(inp["outpoint"]["hash"][::-1])

        # input tx outpoint
        o.append(encoding.encode(inp["outpoint"]["index"], 256, 4)[::-1])

        # input scriptsig
        script = inp.get('script')
        if not script:
            script = bytes()

        scriptsig = encoding.num_to_var_int(len(script)) + script
        o.append(scriptsig)

        # sequence
        o.append(encoding.encode(inp.get("sequence", UINT_MAX - 1), 256, 4)[::-1])

    # number of outputs
    o.append(encoding.num_to_var_int(len(txobj["outs"])))

    # all outputs
    for out in txobj["outs"]:
        # value
        o.append(encoding.encode(out["value"], 256, 8)[::-1])

        # scriptPubKey
        scriptpubkey = encoding.num_to_var_int(len(out['script'])) + out['script']
        o.append(scriptpubkey)

    # add witnesses 
    if have_witness:
        for inp in txobj['ins']:
            witness_script = inp.get('witness_script')
            if not witness_script:
                witness_script = '\x00'

            o.append(witness_script)

    # locktime
    o.append(encoding.encode(txobj["locktime"], 256, 4)[::-1])

    # full string
    ret = ''.join( encoding.json_changebase(o, lambda x: encoding.safe_hexlify(x)) )
    return ret
1181325
def serialize_payload(self):
        
        with io.BytesIO() as stream:
            stream.write(self.OPEN_ASSETS_TAG)

            bitcoin.core.VarIntSerializer.stream_serialize(len(self.asset_quantities), stream)
            for asset_quantity in self.asset_quantities:
                stream.write(self.leb128_encode(asset_quantity))

            bitcoin.core.VarIntSerializer.stream_serialize(len(self.metadata), stream)

            stream.write(self.metadata)

            return stream.getvalue()
1199694
def SerializeExclusiveData(self, writer):
        
        writer.WriteByte(self.AssetType)
        writer.WriteVarString(self.Name)
        writer.WriteFixed8(self.Amount)
        writer.WriteByte(self.Precision)

        self.Owner.Serialize(writer)

        writer.WriteUInt160(self.Admin)
1080880
def serialize(self):
        """"""
        res = []
        for _sort in self.sort_orders:
            res.append(_sort.serialize())
        return res or None
29706
def serialize_me(self, arn, event_time, tech, item=None):
        
        payload = {
            'arn': arn,
            'event_time': event_time,
            'tech': tech
        }

        if item:
            payload['item'] = item

        else:
            payload['event_too_big'] = True

        return self.dumps(payload).data.replace('<empty>', '')
647351
def archive(self):
        """"""
        pipe = self.redis.pipeline(transaction=True)
        pipe.srem(ACTIVE_EXPERIMENTS_REDIS_KEY, self.name)
        pipe.sadd(ARCHIVED_EXPERIMENTS_REDIS_KEY, self.name)
        pipe.execute()
1083000
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('This XARecord is not yet initialized!')

        return struct.pack(self.FMT, self._group_id, self._user_id,
                           self._attributes, b'XA', self._filenum, b'\x00' * 5)
267116
def Serialize(self, writer):
        
        writer.WriteUInt256(self.AssetId)
        writer.WriteFixed8(self.Value)
        writer.WriteUInt160(self.ScriptHash)