'Update the \'CHECKSUM\' and \'DATASUM\' keywords in the header (or
keywords with equivalent semantics given by the ``checksum_keyword``
and ``datasum_keyword`` arguments--see for example ``CompImageHDU``
for an example of why this might need to be overridden).'

def _update_checksum(self, checksum, checksum_keyword='CHECKSUM', datasum_keyword='DATASUM'):

    modified = (self._header._modified or self._data_loaded)
    if (checksum == 'remove'):
        if (checksum_keyword in self._header):
            del self._header[checksum_keyword]
        if (datasum_keyword in self._header):
            del self._header[datasum_keyword]
    elif (modified or self._new or (checksum and (('CHECKSUM' not in self._header) or ('DATASUM' not in self._header)))):
        if (checksum == 'datasum'):
            self.add_datasum(datasum_keyword=datasum_keyword)
        elif (checksum == 'nonstandard_datasum'):
            self.add_datasum(blocking='nonstandard', datasum_keyword=datasum_keyword)
        elif (checksum == 'test'):
            self.add_datasum(self._datasum_comment, datasum_keyword=datasum_keyword)
            self.add_checksum(self._checksum_comment, True, checksum_keyword=checksum_keyword, datasum_keyword=datasum_keyword)
        elif (checksum == 'nonstandard'):
            self.add_checksum(blocking='nonstandard', checksum_keyword=checksum_keyword, datasum_keyword=datasum_keyword)
        elif checksum:
            self.add_checksum(blocking='standard', checksum_keyword=checksum_keyword, datasum_keyword=datasum_keyword)
