Remove a leftover print() and some trailing whitespace.
Add some comments.
Swap the try block with something that *should* be more robust.

Custom sequence classes might fail on this if they don't use the
collections abstract base classes. This is probably not a problem.
This exception actually covers both cases, so use it for both.