Adding the Python encoder and decoder.