code: def processData(config, stats):
      
      if 'total_time' not in stats or 'total_clock' not in stats:
          # toil job not finished yet
          stats.total_time = [0.0]
          stats.total_clock = [0.0]
  
      stats.total_time = sum([float(number) for number in stats.total_time])
      stats.total_clock = sum([float(number) for number in stats.total_clock])
  
      collatedStatsTag = Expando(total_run_time=stats.total_time,
                                 total_clock=stats.total_clock,
                                 batch_system=config.batchSystem,
                                 default_memory=str(config.defaultMemory),
                                 default_cores=str(config.defaultCores),
                                 max_cores=str(config.maxCores)
                                 )
  
      # Add worker info
      worker = [_f for _f in getattr(stats, 'workers', []) if _f]
      jobs = [_f for _f in getattr(stats, 'jobs', []) if _f]
      jobs = [item for sublist in jobs for item in sublist]
  
      def fn4(job):
          try:
              return list(jobs)
          except TypeError:
              return []
  
      buildElement(collatedStatsTag, worker, "worker")
      createSummary(buildElement(collatedStatsTag, jobs, "jobs"),
                    getattr(stats, 'workers', []), "worker", fn4)
      # Get info for each job
      jobNames = set()
      for job in jobs:
          jobNames.add(job.class_name)
      jobTypesTag = Expando()
      collatedStatsTag.job_types = jobTypesTag
      for jobName in jobNames:
          jobTypes = [ job for job in jobs if job.class_name == jobName ]
          buildElement(jobTypesTag, jobTypes, jobName)
      collatedStatsTag.name = "collatedStatsTag"
      return collatedStatsTag
docs: Collate the stats and report