python interface: add type check to __str__ methods
Currently, all classes have a __str__ method, but the next commit
makes this optional. It will then be possible for a subclass
to not have a __str__ method while its superclass does have one.
Calling the method on an object of the subclass will then end up
calling the method of the superclass. This method therefore
needs to check that its argument is of the correct type before
calling the corresponding *_to_str function.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>