Switch to using hasattr() for determining if iterable is actually an iterable.
Added unit test for collapsing a string.