def serialize_v2(self):
    'Serialize in addrv2 format (BIP155)'
    assert (self.net == self.NET_IPV4)
    r = b''
    r += struct.pack('<I', self.time)
    r += ser_compact_size(self.nServices)
    r += struct.pack('B', self.net)
    r += ser_compact_size(self.ADDRV2_ADDRESS_LENGTH[self.net])
    r += socket.inet_aton(self.ip)
    r += struct.pack('>H', self.port)
    return r
Serialize in addrv2 format (BIP155)
def serialize_v2(self):
    
    assert (self.net == self.NET_IPV4)
    r = b
    r += struct.pack('<I', self.time)
    r += ser_compact_size(self.nServices)
    r += struct.pack('B', self.net)
    r += ser_compact_size(self.ADDRV2_ADDRESS_LENGTH[self.net])
    r += socket.inet_aton(self.ip)
    r += struct.pack('>H', self.port)
    return r