Implementation of MapReduce algorithm in Python