code: def partition(self, mapped_values):
          
          partitioned_data = collections.defaultdict(list)
          for key, value in mapped_values:
              partitioned_data[key].append(value)
          return partitioned_data.items()
docs: Organize the mapped values by their key.
          Returns an unsorted sequence of tuples with a key and a sequence of values.