code: def get_summary(result):
      
      summary = {
          "success": result.wasSuccessful(),
          "stat": {
              'total': result.testsRun,
              'failures': len(result.failures),
              'errors': len(result.errors),
              'skipped': len(result.skipped),
              'expectedFailures': len(result.expectedFailures),
              'unexpectedSuccesses': len(result.unexpectedSuccesses)
          }
      }
      summary["stat"]["successes"] = summary["stat"]["total"] \
          - summary["stat"]["failures"] \
          - summary["stat"]["errors"] \
          - summary["stat"]["skipped"] \
          - summary["stat"]["expectedFailures"] \
          - summary["stat"]["unexpectedSuccesses"]
  
      summary["time"] = {
          'start_at': result.start_at,
          'duration': result.duration
      }
      summary["records"] = result.records
  
      return summary
docs: get summary from test result
  
      Args:
          result (instance): HtmlTestResult() instance
  
      Returns:
          dict: summary extracted from result.
  
              {
                  "success": True,
                  "stat": {},
                  "time": {},
                  "records": []
              }