Yes, agreed. And I think there should be 

```
if isinstance(msg, bytes):
    raise TypeError("message must be Unicode")
```

at the top.