serialize python code