I've heard that one byte contains as much data as "about 5 trits".  However, I'm not entirely clear on how the conversion works.

How do I convert binary data into balanced ternary (and vice versa)?

In particular, I am asking because I'd like to implement [proper bytes <-> trytes conversion in PyOTA](https://github.com/iotaledger/iota.lib.py/issues/62), but I don't understand how to handle edge cases (especially surrounding the "**about** 5 trits" part).