def deserialize_v2(self, f):
    'Deserialize from addrv2 format (BIP155)'
    self.time = struct.unpack('<I', f.read(4))[0]
    self.nServices = deser_compact_size(f)
    self.net = struct.unpack('B', f.read(1))[0]
    assert (self.net == self.NET_IPV4)
    address_length = deser_compact_size(f)
    assert (address_length == self.ADDRV2_ADDRESS_LENGTH[self.net])
    self.ip = socket.inet_ntoa(f.read(4))
    self.port = struct.unpack('>H', f.read(2))[0]
Deserialize from addrv2 format (BIP155)
def deserialize_v2(self, f):
    
    self.time = struct.unpack('<I', f.read(4))[0]
    self.nServices = deser_compact_size(f)
    self.net = struct.unpack('B', f.read(1))[0]
    assert (self.net == self.NET_IPV4)
    address_length = deser_compact_size(f)
    assert (address_length == self.ADDRV2_ADDRESS_LENGTH[self.net])
    self.ip = socket.inet_ntoa(f.read(4))
    self.port = struct.unpack('>H', f.read(2))[0]