Doesn't work. You have to explictly check if the string is a unicode and convert it to str if so.
Like this:
```python
if sys.version_info >= (3,):
[...]
else:
[...]
    def b(s):
        if isinstance(s, unicode):
            return s.encode('utf-8')
        return s
```

I'll renew my pull request.