code: def download_badge(test_stats,                  # type: TestStats
                     dest_folder='reports/junit'  # type: str
                     ):
      
      if not path.exists(dest_folder):
          makedirs(dest_folder)  # , exist_ok=True) not python 2 compliant
  
      if test_stats.success_percentage < 50:
          color = 'red'
      elif test_stats.success_percentage < 75:
          color = 'orange'
      elif test_stats.success_percentage < 90:
          color = 'green'
      else:
          color = 'brightgreen'
  
      left_txt = "tests"
      # right_txt = "%s%%" % test_stats.success_percentage
      right_txt = "%s/%s" % (test_stats.success, test_stats.runned)
      url = 'https://img.shields.io/badge/%s-%s-%s.svg' % (left_txt, quote_plus(right_txt), color)
  
      dest_file = path.join(dest_folder, 'junit-badge.svg')
  
      print('Generating junit badge from : ' + url)
      response = requests.get(url, stream=True)
      with open(dest_file, 'wb') as out_file:
          response.raw.decode_content = True
          shutil.copyfileobj(response.raw, out_file)
      del response
docs: Downloads the badge corresponding to the provided success percentage, from https://img.shields.io.
  
      :param test_stats:
      :param dest_folder:
      :return: