add python example

modified version of Zheng Zhang's code. Thank you Zheng Zhang!