Parse the given packet and update properties accordingly

def from_bytes(cls, bitstream):
        '''
        Parse the given packet and update properties accordingly
        '''
        packet = cls()

        # Convert to ConstBitStream (if not already provided)
        if not isinstance(bitstream, ConstBitStream):
            if isinstance(bitstream, Bits):
                bitstream = ConstBitStream(auto=bitstream)
            else:
                bitstream = ConstBitStream(bytes=bitstream)

        # Read the type
        type_nr = bitstream.read('uint:4')
        if type_nr != packet.message_type:
            msg = 'Invalid bitstream for a {0} packet'
            class_name = packet.__class__.__name__
            raise ValueError(msg.format(class_name))

        # Skip reserved bits
        packet._reserved1 = bitstream.read(20)

        # Store the record count
        record_count = bitstream.read('uint:8')

        # Store the nonce
        packet.nonce = bitstream.read('bytes:8')

        # Read the records
        for dummy in range(record_count):
            record = MapReferralRecord.from_bytes(bitstream)
            packet.records.append(record)

        # Verify that the properties make sense
        packet.sanitize()

        return packet