def METHOD_NAME(self, item, treeItem, select=None):
    si = None
    if isinstance(item, ViewBox):
        si = QtWidgets.QTreeWidgetItem(['ViewBox'])
    elif isinstance(item, PlotItem):
        si = QtWidgets.QTreeWidgetItem(['Plot'])
    if si is not None:
        si.gitem = item
        treeItem.addChild(si)
        treeItem = si
        if si.gitem is select:
            self.ui.itemTree.setCurrentItem(si)
    for ch in item.childItems():
        self.METHOD_NAME(ch, treeItem, select=select)