Use basestring instead of (str, unicode)

basestring was introduced with Python 2.3, we only support 2.4+, anyway.
Remove workaround for nonexisting bug

The workaround is for a bug that was fixed in Python 2.3.3, see e.g.
https://bugzilla.redhat.com/show_bug.cgi?id=88543
We only support Python 2.4+, anyway.
Only catch Exception, not BaseException
Use isinstance() instead of hasattr() for type checking