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

def _calculate_datasum(self, blocking):

    if self._has_data:
        bytes_array = self.data.view(type=np.ndarray, dtype=np.ubyte)
        padding = np.fromstring((_pad_length(self.size) * '    '), dtype=np.ubyte)
        d = np.append(bytes_array, padding)
        cs = self._compute_checksum(d, blocking=blocking)
        return cs
    else:
        return super(TableHDU, self)._calculate_datasum(blocking)
