docs: def write_unitth(suites, out_dir):
          """ Write UnitTH-style test reports 
  
          Args:
              suites (:obj:`dict`): dictionary of test suites
              out_dir (:obj:`str`): path to save UnitTH-style test reports
          """
          if not os.path.isdir(out_dir):
              os.mkdir(out_dir)
  
          for classname, cases in suites.items():
              doc_xml = minidom.Document()
  
              suite_xml = doc_xml.createElement('testsuite')
              suite_xml.setAttribute('name', classname)
              suite_xml.setAttribute('tests', str(len(cases)))
              suite_xml.setAttribute('errors', str(sum('error' in case for case in cases)))
              suite_xml.setAttribute('failures', str(sum('failure' in case for case in cases)))
              suite_xml.setAttribute('skipped', str(sum('skipped' in case for case in cases)))
              suite_xml.setAttribute('time', '{:.3f}'.format(sum(case['time'] for case in cases)))
              doc_xml.appendChild(suite_xml)
  
              for case in cases:
                  case_xml = doc_xml.createElement('testcase')
                  case_xml.setAttribute('classname', classname)
                  case_xml.setAttribute('name', case['name'])
                  case_xml.setAttribute('time', '{:.3f}'.format(case['time']))
                  suite_xml.appendChild(case_xml)
  
                  if 'skipped' in case:
                      skipped_xml = doc_xml.createElement('skipped')
                      skipped_xml.setAttribute('type', case['skipped']['type'])
                      skipped_xml.setAttribute('message', case['skipped']['message'])
                      case_xml.appendChild(skipped_xml)
  
                      skipped_text_xml = doc_xml.createCDATASection(case['skipped']['text'])
                      skipped_xml.appendChild(skipped_text_xml)
  
                  if 'failure' in case:
                      failure_xml = doc_xml.createElement('failure')
                      failure_xml.setAttribute('type', case['failure']['type'])
                      failure_xml.setAttribute('message', case['failure']['message'])
                      case_xml.appendChild(failure_xml)
  
                      failure_text_xml = doc_xml.createCDATASection(case['failure']['text'])
                      failure_xml.appendChild(failure_text_xml)
  
                  if 'error' in case:
                      error_xml = doc_xml.createElement('error')
                      error_xml.setAttribute('type', case['error']['type'])
                      error_xml.setAttribute('message', case['error']['message'])
                      case_xml.appendChild(error_xml)
  
                      error_text_xml = doc_xml.createCDATASection(case['error']['text'])
                      error_xml.appendChild(error_text_xml)
  
              with open(os.path.join(out_dir, '{}.xml'.format(classname)), 'w') as output:
                  doc_xml.writexml(output, encoding='utf-8', addindent='', newl="")
              doc_xml.unlink()