def comment_uncomment_selected_nodes(self):
        """Toggle commented out state of selected nodes.

        Nodes attached to the selected ones are also
        affected.
        """
        ### retrieve all selected node instances

        selected_nodes = [
            obj for obj in self.selected_objs if not isinstance(obj, TextBlock)
        ]

        ### if there are no selected node instances,
        ### notify user and return earlier, since there's
        ### nothing to be done in this case

        if not selected_nodes:

            create_and_show_dialog(
                (
                    "In order to comment/uncomment selected"
                    " nodes at least one must be selected"
                ),
                level_name='info',
            )

        ### otherwise, delegate the
        ### commenting/uncommenting to another
        ### method
        else:
            self.comment_uncomment_nodes(selected_nodes)
Toggle commented out state of selected nodes.

        Nodes attached to the selected ones are also
        affected.
        
nodezator/editing/data.py