util: fix bug in to_uid function

It must check for string_types, not str only.
tests: import unicode_literals from future
Merge pull request #397 from fsouza/master

util: fix bug in to_uid function