def METHOD_NAME(self, index, role):
    if not index.isValid():
        return None
    item = index.internalPointer()
    if role == QtCore.Qt.DisplayRole:
        if index.column() == 0:
            return item.key
        if index.column() == 1:
            return item.value
    elif role == QtCore.Qt.EditRole:
        if index.column() == 1:
            return item.value