@classmethod
    def _deserialize(cls, io, strict=False, raw_payload=False):
        size = U32BE.read(io)
        type_ = FourCC.read(io)
        header_size = 8
        extended_size = False

        if size == 1:
            size = U64BE.read(io)
            header_size += 8
            extended_size = True

        if size == 0:
            data = io.read()
        else:
            data = chunked_read(io, size - header_size, exception=F4VError)

        if type_ in PayloadTypes and not raw_payload:
            payloadcls = PayloadTypes[type_]
            payloadio = BytesIO(data)
            payload = payloadcls.deserialize(payloadio)
        else:
            payload = RawPayload(data)

        box = cls(type_, payload, extended_size)

        if strict and box.size != size:
            raise F4VError("Data size mismatch when deserialising tag")

        return box
dataset/ETHPy150Open chrippa/livestreamer/src/livestreamer/packages/flashmedia/box.py/Box._deserialize/original