def serialize(self, with_witness=False):
    r = b''
    r += self.header.serialize()
    r += struct.pack('<Q', self.nonce)
    r += ser_compact_size(self.shortids_length)
    for x in self.shortids:
        r += struct.pack('<Q', x)[0:6]
    if with_witness:
        r += ser_vector(self.prefilled_txn, 'serialize_with_witness')
    else:
        r += ser_vector(self.prefilled_txn, 'serialize_without_witness')
    return r
def serialize(self, with_witness=False):
    r = b
    r += self.header.serialize()
    r += struct.pack('<Q', self.nonce)
    r += ser_compact_size(self.shortids_length)
    for x in self.shortids:
        r += struct.pack('<Q', x)[0:6]
    if with_witness:
        r += ser_vector(self.prefilled_txn, 'serialize_with_witness')
    else:
        r += ser_vector(self.prefilled_txn, 'serialize_without_witness')
    return r