Correct the method objectToString and the handling of collections.

This corrects the issue detailed here:
https://github.com/jrl-umi3218/dynamic-graph-python/issues/2

Solution found by Florent Lamiraux.