class_docstr: Class which encapsulates logit of the master.
docstr: Saves sorted (by score) results of the evaluation.
  
  Args:
    run_stats: dictionary with runtime statistics for submissions,
      can be generated by WorkPiecesBase.compute_work_statistics
    scores: dictionary mapping submission ids to scores
    image_count: dictionary with number of images processed by submission
    filename: output filename
code: def _save_sorted_results(
      self, run_stats, scores, image_count, filename
  ):
      """Saves sorted (by score) results of the evaluation.
  
      Args:
        run_stats: dictionary with runtime statistics for submissions,
          can be generated by WorkPiecesBase.compute_work_statistics
        scores: dictionary mapping submission ids to scores
        image_count: dictionary with number of images processed by submission
        filename: output filename
      """
      with open(filename, "w") as f:
          writer = csv.writer(f)
          writer.writerow(
              [
                  "SubmissionID",
                  "ExternalTeamId",
                  "Score",
                  "MedianTime",
                  "ImageCount",
              ]
          )
  
          def get_second(x):
              """Returns second entry of a list/tuple"""
              return x[1]
  
          for s_id, score in sorted(
              iteritems(scores), key=get_second, reverse=True
          ):
              external_id = self.submissions.get_external_id(s_id)
              stat = run_stats.get(
                  s_id, collections.defaultdict(lambda: float("NaN"))
              )
              writer.writerow(
                  [
                      s_id,
                      external_id,
                      score,
                      stat["median_eval_time"],
                      image_count[s_id],
                  ]
              )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import collections
  from collections import defaultdict
  import csv
  from io import BytesIO
  import logging
  import os
  import pickle
  import random
  import time
  from six import iteritems
  from six import iterkeys
  from six import itervalues
  from six.moves import input
  import eval_lib
label_desc: Use image node_id 6 for calling the EvaluationMaster obj's underlying member method code with example usage: obj._save_sorted_results(run_stats, scores, image_count, filename) and returns: x