Python implementation of Huffman compression algorithm