'Calculate the value for the ``DATASUM`` card in the HDU.'

def _calculate_datasum(self, blocking):

    if (not self._data_loaded):
        if (self.size > 0):
            raw_data = self._get_raw_data(self._data_size, 'ubyte', self._data_offset)
            return self._compute_checksum(raw_data, blocking=blocking)
        else:
            return 0
    elif (self.data is not None):
        return self._compute_checksum(self.data.view('ubyte'), blocking=blocking)
    else:
        return 0
