def serialize(self, *, with_time=True):
    'Serialize in addrv1 format (pre-BIP155)'
    assert (self.net == self.NET_IPV4)
    r = b''
    if with_time:
        r += struct.pack('<I', self.time)
    r += struct.pack('<Q', self.nServices)
    r += ((b'\x00' * 10) + (b'\xff' * 2))
    r += socket.inet_aton(self.ip)
    r += struct.pack('>H', self.port)
    return r
Serialize in addrv1 format (pre-BIP155)
def serialize(self, *, with_time=True):
    
    assert (self.net == self.NET_IPV4)
    r = b
    if with_time:
        r += struct.pack('<I', self.time)
    r += struct.pack('<Q', self.nServices)
    r += ((b'\x00' * 10) + (b'\xff' * 2))
    r += socket.inet_aton(self.ip)
    r += struct.pack('>H', self.port)
    return r