Python DG code for teaching/demonstration