Python3 compatibility work for basestring type

This is the method described at http://stackoverflow.com/questions/4232111/stringtype-and-nonetype-in-python3-x