Canonical huffman, run length encoder and decoder in Python and C