<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def comp_idat(self, idat):
 """Generator that produce compressed IDAT chunks from IDAT data"""

        # http://www.w3.org/TR/PNG/#11IDAT
        if self.compression is not None:
            compressor = zlib.compressobj(self.compression)
        else:
            compressor = zlib.compressobj()
        for dat in idat:
            compressed = compressor.compress(dat)
            if len(compressed):
                yield compressed
        flushed = compressor.flush()
        if len(flushed):
            yield flushed