code: def chunk(self, lenient=False):
          
  
          self.validate_signature()
  
          # http://www.w3.org/TR/PNG/#5Chunk-layout
          if not self.atchunk:
              self.atchunk = self._chunk_len_type()
          if not self.atchunk:
              raise ChunkError("No more chunks.")
          length, type = self.atchunk
          self.atchunk = None
  
          data = self.file.read(length)
          if len(data) != length:
              raise ChunkError(
                  'Chunk %s too short for required %i octets.'
                  % (type, length))
          checksum = self.file.read(4)
          if len(checksum) != 4:
              raise ChunkError('Chunk %s too short for checksum.' % type)
          verify = zlib.crc32(type)
          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:
              (a, ) = struct.unpack('!I', checksum)
              (b, ) = struct.unpack('!I', verify)
              message = ("Checksum error in %s chunk: 0x%08X != 0x%08X."
                         % (type.decode('ascii'), a, b))
              if lenient:
                  warnings.warn(message, RuntimeWarning)
              else:
                  raise ChunkError(message)
          return type, data
docs: Read the next PNG chunk from the input file;
          returns a (*type*, *data*) tuple.
          *type* is the chunk's type as a byte string
          (all PNG chunk types are 4 bytes long).
          *data* is the chunk's data content, as a byte string.
  
          If the optional `lenient` argument evaluates to `True`,
          checksum failures will raise warnings rather than exceptions.