code: def findTopLevelItemIndex(self, childIndex):
          
          if self.isTopLevelIndex(childIndex):
              return childIndex
          else:
              return self.findTopLevelItemIndex(childIndex.parent())
docs: Traverses the tree upwards from childItem until its top level ancestor item is found.
              Top level items are items that are direct children of the (invisible) root item.
              This function therefore raises an exception when called with the root item.