'Compute the ones-complement checksum of a sequence of bytes.
Parameters
data
a memory region to checksum
sum32
incremental checksum value from another region
blocking
"standard", "nonstandard", or "either"
selects the block size on which to perform checksumming,
originally the blocksize was chosen incorrectly.  "nonstandard"
selects the original approach,  "standard" selects the
interoperable blocking size of 2880 bytes.  In the context of
_compute_checksum, "either" is synonymous with "standard".
Returns
ones complement checksum'

def _compute_checksum(self, data, sum32=0, blocking='standard'):

    blocklen = {'standard': 2880, 'nonstandard': len(data), 'either': 2880, True: 2880}[blocking]
    sum32 = np.uint32(sum32)
    for i in range(0, len(data), blocklen):
        length = min(blocklen, (len(data) - i))
        sum32 = self._compute_hdu_checksum(data[i:(i + length)], sum32)
    return sum32
