docstr: Format the results to json (standard format for COCO evaluation).
  
  Args:
      results (list[tuple | numpy.ndarray]): Testing results of the
          dataset.
      jsonfile_prefix (str | None): The prefix of json files. It includes
          the file path and the prefix of filename, e.g., "a/b/prefix".
          If not specified, a temp file will be created. Default: None.
  
  Returns:
      tuple: (result_files, tmp_dir), result_files is a dict containing                 the json filepaths, tmp_dir is the temporal directory created                 for saving json files when jsonfile_prefix is not specified.
docstr_tok: ["Format","the","results","to","json","(","standard","format","for","COCO","evaluation",")",".","Args",":","results","(","list","[","tuple","|","numpy.ndarray","]",")",":","Testing","results","of","the","dataset",".","jsonfile_prefix","(","str","|","None",")",":","The","prefix","of","json","files",".","It","includes","the","file","path","and","the","prefix","of","filename",",","e.g.",",","``","a\/b\/prefix","''",".","If","not","specified",",","a","temp","file","will","be","created",".","Default",":","None",".","Returns",":","tuple",":","(","result_files",",","tmp_dir",")",",","result_files","is","a","dict","containing","the","json","filepaths",",","tmp_dir","is","the","temporal","directory","created","for","saving","json","files","when","jsonfile_prefix","is","not","specified","."]
code: def format_results(self, results, jsonfile_prefix=None, **kwargs):
      """Format the results to json (standard format for COCO evaluation).
  
          Args:
              results (list[tuple | numpy.ndarray]): Testing results of the
                  dataset.
              jsonfile_prefix (str | None): The prefix of json files. It includes
                  the file path and the prefix of filename, e.g., "a/b/prefix".
                  If not specified, a temp file will be created. Default: None.
  
          Returns:
              tuple: (result_files, tmp_dir), result_files is a dict containing \
                  the json filepaths, tmp_dir is the temporal directory created \
                  for saving json files when jsonfile_prefix is not specified.
          """
      assert isinstance(results, list), "results must be a list"
      assert len(results) == len(
          self
      ), "The length of results is not equal to the dataset len: {} != {}".format(
          len(results), len(self)
      )
  
      if jsonfile_prefix is None:
          tmp_dir = tempfile.TemporaryDirectory()
          jsonfile_prefix = osp.join(tmp_dir.name, "results")
      else:
          tmp_dir = None
      result_files = self.results2json(results, jsonfile_prefix)
      return result_files, tmp_dir
  
imports: import itertools
  import logging
  import os.path
  import tempfile
  from collections import OrderedDict
  import mmcv
  import numpy
  from mmcv.utils import print_log
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from terminaltables import AsciiTable
  from mmdet.core import eval_recalls
  from .builder import DATASETS
  from .custom import CustomDataset
label_desc: Use image node_id 12 for calling the CocoDataset obj's underlying member method code with example usage: obj.format_results(results, jsonfile_prefix) and returns: result_files,  tmp_dir