def OnTreeItemMenu(self, event):
        tree = event.GetEventObject()
        items = tree.GetSelections()
        if not items:
            items = [event.GetItem()]

        nodes_and_ctxs = []
        for item in items:
            data = tree.GetPyData(item)
            if not data:
                return
            ctx, node = data
            if (node, ctx) is not nodes_and_ctxs:
                nodes_and_ctxs.append((node, ctx))
        nodes, ctxs = zip(*nodes_and_ctxs)

        def _show_dag(event):
            self.ShowDag(nodes, ctxs[0])

        def _plot(event):
            self.Plot(nodes, ctxs)

        def _export_to_excel(event):
            self.ExportToExcel(nodes, ctxs)

        def _add_to_root(event):
            for node, ctx in nodes_and_ctxs:
                self.AddNodeToRoot(node, ctx)

        menu = wx.Menu()
        show_dag = menu.Append(wx.NewId(), "Show DAG")

        is_first_level = tree.GetItemParent(item) == tree.GetRootItem()
        if not is_first_level:
            add_to_root = menu.Append(wx.NewId(), "Add to root")
            menu.Bind(wx.EVT_MENU, _add_to_root, id=add_to_root.Id)

        export = menu.Append(wx.NewId(), "Export to Excel")
        plot = menu.Append(wx.NewId(), "Plot")
        menu.Bind(wx.EVT_MENU, _show_dag, id=show_dag.Id)
        menu.Bind(wx.EVT_MENU, _export_to_excel, id=export.Id)
        menu.Bind(wx.EVT_MENU, _plot, id=plot.Id)

        rect = tree.GetBoundingRect(item)
        position = event.GetPoint().x, rect.GetBottom()
        self.PopupMenu(menu, position)
dataset/ETHPy150Open manahl/mdf/mdf/viewer/frame.py/MDFViewerFrame.OnTreeItemMenu/operator `not in` -> `is not`