adding python implementations in chap 16, 17 for better understanding