def header_size(self):
        """Size of `file`'s header in bytes.

        The size of the header is determined from `header`. If this is not
        possible (i.e., before the header has been read), 0 is returned.
        """
        if not self.header:
            return 0

        # Determine header size by finding the largest offset and the
        # value of the corresponding entry. The header size is the
        # offset plus the size of the entry.
        max_entry = max(self.header.values(),
                        key=lambda val: val['offset'])
        return max_entry['offset'] + max_entry['value'].nbytes