Adding a helpful return-parent function for lists, test suite functionality.

The return-parent function will return the parent given (unless it
was given to be NULL, in which case it then returns the new node).

(This was created because of a need to be able to create node lists
in-place using the same code (see the test_register_hook function))