def METHOD_NAME(self, index):
    """Get an index to the parent of the given index.
    Override QAbstractItemModel::parent.
    Args:
        index: The QModelIndex to get the parent index for.
    """
    parent_cat = index.internalPointer()
    if not parent_cat:
        # categories have no parent
        return QModelIndex()
    row = self._categories.index(parent_cat)
    return self.createIndex(row, 0, None)