code: def hasChildren(self, parentIndex=QtCore.QModelIndex()):
          
          parentItem = self.getItem(parentIndex, altItem=self.invisibleRootItem)
          return parentItem.hasChildren()
docs: Returns true if parent has any children; otherwise returns false.
              Use rowCount() on the parent to find out the number of children.