encode and decode the python stuff