def invariant(self):
<EOL>assert isinstance(self.description, str)<EOL>assert isinstance(self.singleNodeOnly, bool)<EOL>assert isinstance(self.inputs, dict)<EOL>assert isinstance(self.outputs, dict)<EOL>assert isinstance(self.parameters, dict)<EOL>assert isinstance(self.commands, dict)<EOL>hasDefaultInput = False<EOL>for k, v in self.inputs.items():<EOL><INDENT>assert isinstance(k, str)<EOL>assert isinstance(v, InputSpec)<EOL>v.invariant()<EOL>if v.isDefaultInput:<EOL><INDENT>assert not hasDefaultInput<EOL>hasDefaultInput = True<EOL><DEDENT><DEDENT>hasDefaultOutput = False<EOL>for k, v in self.outputs.items():<EOL><INDENT>assert isinstance(k, str)<EOL>assert isinstance(v, OutputSpec)<EOL>v.invariant()<EOL>if v.isDefaultOutput:<EOL><INDENT>assert not hasDefaultOutput<EOL>hasDefaultOutput = True<EOL><DEDENT><DEDENT>for k, v in self.parameters.items():<EOL><INDENT>assert isinstance(k, str)<EOL>assert isinstance(v, ParameterSpec)<EOL>v.invariant()<EOL><DEDENT>for k, v in self.commands.items():<EOL><INDENT>assert isinstance(k, str)<EOL>assert isinstance(v, CommandSpec)<EOL>v.invariant()<EOL><DEDENT>
Verify the validity of the node spec object

        The type of each sub-object is verified and then
        the validity of each node spec item is verified by calling
        it invariant() method. It also makes sure that there is at most
        one default input and one default output.