A Python port of the JJDecoder written by Syed Zainudeen