reference python code

reference python code