def write_chunk(outfile, tag, data=b''):
    """
    Write a PNG chunk to the output file, including length and
    checksum.
    """

    # http://www.w3.org/TR/PNG/#5Chunk-layout
    outfile.write(struct.pack("!I", len(data)))
    outfile.write(tag)
    outfile.write(data)
    checksum = zlib.crc32(tag)
    checksum = zlib.crc32(data, checksum)
    checksum &= 1-2**32
    outfile.write(struct.pack("!I", checksum))
dataset/ETHPy150Open jyapayne/Web2Executable/png.py/write_chunk/swapped operands of `-`