def comment_uncomment_nodes(self, nodes):
        """Toggle commenting state in each subgraph.

        Also, keeps track of the toggled states so that
        actions performed are properly reported.
        """

        toggled_states = set()

        for subgraph in yield_subgraphs(nodes):

            ### sample the state of the nodes from one of
            ### them; it can be any node, we use the first
            ### one

            current_state = subgraph[0].data.get("commented_out", False)

            ### toggle the state
            toggled_state = not current_state

            ### store the toggled state
            toggled_states.add(toggled_state)

            ### apply the toggled state to all nodes in the
            ### subgraph

            for node in subgraph:

                node.data["commented_out"] = toggled_state
                node.perform_commenting_uncommenting_setups()

        ### indicate the change in the data
        indicate_unsaved()

        ## indicate birdseye view state of window manager must
        ## have its objects updated next time it is set
        APP_REFS.ea.must_update_birdseye_view_objects = True

        ### indicate finished action in status bar

        ## build string specifying actions performed,
        ## according to toggled states applied
        ##
        ## note that we sort the order of the states, so
        ## that the items, when more than one, always
        ## appear in the same order

        actions = "/".join(
            ACTION_DESCRIPTION_MAP[toggled_state]
            for toggled_state in sorted(toggled_states)
        )

        ## build a message with the actions
        message = "Nodes were {}.".format(actions)

        ## finally display the message in the status bar
        set_status_message(message)
Toggle commenting state in each subgraph.

        Also, keeps track of the toggled states so that
        actions performed are properly reported.
        
nodezator/editing/data.py