modified as python example