Check for basestring, not just str

Fixes #2071
Remove unnecessary check for builtin_str
Merge pull request #2072 from sigmavirus24/fix-urlencoded-bytes

Check for basestring, not just str