code: def headerData(self, section, orientation, role):
          
          if role == Qt.TextAlignmentRole:
              if orientation == Qt.Horizontal:
                  return Qt.AlignCenter | Qt.AlignBottom
              else:
                  return Qt.AlignRight | Qt.AlignVCenter
          if role != Qt.DisplayRole and role != Qt.ToolTipRole:
              return None
          if self.model.header_shape[0] <= 1 and orientation == Qt.Horizontal:
              if self.model.name(1,section):
                  return self.model.name(1,section)
              return _('Index')
          elif self.model.header_shape[0] <= 1:
              return None
          elif self.model.header_shape[1] <= 1 and orientation == Qt.Vertical:
              return None
          return _('Index') + ' ' + to_text_string(section)
docs: Get the text to put in the header of the levels of the indexes.
  
          By default it returns 'Index i', where i is the section in the index