Algorithm Using Mapreduce In Python