Map And Reduce Function In Python