code: def flags(self, index):
          
          if index.isValid():
              item = index.internalPointer()
              return item.flags(index)
          else:
              super(TreeModel, self).flags(index)
docs: Return the flags for the given index
  
          This will call :meth:`TreeItem.flags` for valid ones.
  
          :param index: the index to query
          :type index: :class:`QtCore.QModelIndex`
          :returns: None
          :rtype: None
          :raises: None