Rice coding in Python