fixed bopomofo conversion

I'm not much of a Python programmer, so this code is probably unpythonic. I wrote this code in Go and then ported it (you can see the Go code in my chineseutils-go repo). I also included some unit tests of a few of the trickiest cases, so if you decide to refactor it will be harder to introduce new issues. Resolves issue #39.