python program for high order function