code: def commit_output(cls, shard_ctx, iterator):
      
      # We accept an iterator just in case output references get too big.
      outs = tuple(iterator)
      shard_ctx._state.writer_state["outs"] = outs
docs: Saves output references when a shard finishes.
  
      Inside end_shard(), an output writer can optionally use this method
      to persist some references to the outputs from this shard
      (e.g a list of filenames)
  
      Args:
        shard_ctx: map_job_context.ShardContext for this shard.
        iterator: an iterator that yields json serializable
          references to the outputs from this shard.
          Contents from the iterator can be accessible later via
          map_job.Job.get_outputs.