Are you sure message is str? Otherwise you should do something like this:

```python
if isinstance(message, unicode): message = message.encode("utf-8")
```