Make the check for string types also work on Python 3.

Fixes #37