'Read and verify checksum'

def crc(self, cid, data):

    if (ImageFile.LOAD_TRUNCATED_IMAGES and ((i8(cid[0]) >> 5) & 1)):
        self.crc_skip(cid, data)
        return
    try:
        crc1 = Image.core.crc32(data, Image.core.crc32(cid))
        crc2 = (i16(self.fp.read(2)), i16(self.fp.read(2)))
        if (crc1 != crc2):
            raise SyntaxError(('broken    PNG    file    (bad    header    checksum    in    %r)' % cid))
    except struct.error:
        raise SyntaxError(('broken    PNG    file    (incomplete    checksum    in    %r)' % cid))
