[Python] The builtin basestring is no more with py3. Fixes issue 5701.