Shannon-Fano coding in Python.