code: def index(self, row, column, parentIndex=QtCore.QModelIndex()):
          
  #        logger.debug("  called index({}, {}, {}) {}"
  #                     .format(parentIndex.row(), parentIndex.column(), parentIndex.isValid(),
  #                             parentIndex.isValid() and parentIndex.column() != 0))
  
          parentItem = self.getItem(parentIndex, altItem=self.invisibleRootItem)
          #logger.debug("    Getting row {} from parentItem: {}".format(row, parentItem))
  
          if not (0 <= row < parentItem.nChildren()):
              # Can happen when deleting the last child.
              #logger.warn("Index row {} invalid for parent item: {}".format(row, parentItem))
              return QtCore.QModelIndex()
  
          if not (0 <= column < self.columnCount()):
              #logger.warn("Index column {} invalid for parent item: {}".format(column, parentItem))
              return QtCore.QModelIndex()
  
          childItem = parentItem.child(row)
          if childItem:
              return self.createIndex(row, column, childItem)
          else:
              logger.warn("No child item found at row {} for parent item: {}".format(row, parentItem))
              return QtCore.QModelIndex()
docs: Returns the index of the item in the model specified by the given row, column and parent
              index.
  
              Since each item contains information for an entire row of data, we create a model index
              to uniquely identify it by calling createIndex() it with the row and column numbers and
              a pointer to the item. (In the data() function, we will use the item pointer and column
              number to access the data associated with the model index; in this model, the row number
              is not needed to identify data.)
  
              When reimplementing this function in a subclass, call createIndex() to generate
              model indexes that other components can use to refer to items in your model.