Fixed #1 - Use basestring instead of str

Replace isinstance(x, str) to isinstance(x, basestring)