def read_chunk(self):
        # http://www.w3.org/TR/PNG/#5Chunk-layout
        try:
            data_bytes, tag = struct.unpack('!I4s', self.file.read(8))
        except struct.error:
            raise ValueError('Chunk too short for header')
        data = self.file.read(data_bytes)
        if len(data) != data_bytes:
            raise ValueError('Chunk %s too short for required %i data octets'
                             % (tag, data_bytes))
        checksum = self.file.read(4)
        if len(checksum) != 4:
            raise ValueError('Chunk %s too short for checksum', tag)
        verify = zlib.crc32(tag)
        verify = zlib.crc32(data, verify)
        # Whether the output from zlib.crc32 is signed or not varies
        # according to hideous implementation details, see
        # http://bugs.python.org/issue1202 .
        # We coerce it to be positive here (in a way which works on
        # Python 2.3 and older).
        verify &= 2**32 - 1
        verify = struct.pack('!I', verify)
        if checksum != verify:
            # print repr(checksum)
            (a,) = struct.unpack('!I', checksum)
            (b,) = struct.unpack('!I', verify)
            raise ValueError("Checksum error in %s chunk: 0x%X != 0x%X"
                             % (tag, a, b))
        return tag, data
Turn a guest on/off based on a given guest_id
dataset/ETHPy150Open ardekantur/pyglet/pyglet/image/codecs/pypng.py/Reader.read_chunk--crossover with--dataset/ETHPy150Open locaweb/simplestack/src/simplestack/server.py/power_guest