def cut(cut, node_indices):
    """Check that the cut is for only the given nodes."""
    if cut.indices != node_indices:
        raise ValueError('{} nodes are not equal to subsystem nodes '
                         '{}'.format(cut, node_indices))
Check that the cut is for only the given nodes.