Python script for MapReduce