MapReduce implementation in Python