@classmethod
    def _deserialize(cls, io):
        version = U16BE.read(io)

        if not (0, 3) in version:
            raise AMFError("AMF version must be 0 or 3")

        headers = []
        header_count = U16BE.read(io)

        for i in range(header_count):
            header = AMFHeader.deserialize(io)
            headers.append(header)

        messages = []
        message_count = U16BE.read(io)
        for i in range(message_count):
            message = AMFMessage.deserialize(io)
            messages.append(message)

        return cls(version, headers, messages)
dataset/ETHPy150Open chrippa/livestreamer/src/livestreamer/packages/flashmedia/amf.py/AMFPacket._deserialize/swapped operands of `in`