'Calculate the value of the ``CHECKSUM`` card in the HDU.'

def _calculate_checksum(self, datasum, blocking, checksum_keyword='CHECKSUM'):

    old_checksum = self._header[checksum_keyword]
    self._header[checksum_keyword] = ('0' * 16)
    s = str(self._header)
    cs = self._compute_checksum(np.fromstring(s, dtype='ubyte'), datasum, blocking=blocking)
    s = self._char_encode((~ cs))
    self._header[checksum_keyword] = old_checksum
    return s
