Use basestring to allow comparisons to unicode in Python 2

closes #685