code: def format(file_metrics, build_metrics):
      
      metrics = {'files': file_metrics}
      if build_metrics:
          metrics['build'] = build_metrics
      body = json.dumps(metrics, sort_keys=True, indent=4) + '\n'
      return body
docs: compute output in JSON format.