2to3: Apply basestring fixer.

The basestring class is not defined in Python 3 and the fixer replaces
it with str. In order to have a common code base we define basestring in
numpy/compat/py3k.py to be str when the Python version is >= 3,
otherwise basestring and import it where needed.  That works for most
cases, but there are a few files where the version dependent define
needs to be in the file.

Closes #3042.
Merge pull request #3237 from charris/2to3-apply-basestring

2to3: Apply basestring fixer.