code: def __generate(results):
          doc, tag, text = Doc().tagtext()
          count = 0
          fails = 0
          errors = 0
          skips = 0
          for result in results:
              if result.passed() is False:
                  if result.retries_left > 0:
                      continue
              count += 1
              if result.passed():
                  continue
              elif result.skipped():
                  skips += 1
              elif result.was_inconclusive():
                  errors += 1
              else:
                  fails += 1
          with tag('testsuite',
                   tests=str(count),
                   failures=str(fails),
                   errors=str(errors),
                   skipped=str(skips)):
              for result in results:
                  if result.passed() is False and result.retries_left > 0:
                      continue
                  class_name = result.get_tc_name()
                  models = result.get_dut_models()
                  if models:
                      class_name = class_name + "." + models
                  name = result.get_toolchain()
                  with tag('testcase', classname=class_name, name=name,
                           time=result.get_duration(seconds=True)):
                      if result.stdout:
                          with tag('system-out'):
                              text(result.stdout)
                      if result.passed():
                          continue
                      elif result.skipped():
                          with tag('skipped'):
                              text(result.skip_reason)
                      elif result.was_inconclusive():
                          with tag('error', message=hex_escape_str(result.fail_reason)):
                              text(result.stderr)
                      else:
                          with tag('failure', message=hex_escape_str(result.fail_reason)):
                              text(result.stderr)
          return indent(
              doc.getvalue(),
              indentation=' '*4
          )