API Reference
nuke.
collapseToGroup
Moves the currently selected nodes to a new group, maintaining their previous connections.
show – If show is True, the node graph for the new group is shown in the background.
The new Group node.