For python3 compatibility, we have to use the `encode` and `decode` string methods rather than the `unicode` type.