def METHOD_NAME(prefix_counts):
  """Outputs the given prefix counts and percentages as HTML.
  Specifically, a sortable HTML table is produced, where the app names
  are column headers, and one language is output per row.  Entries
  are colour-coded based on the percent completeness.
  Args:
      prefix_counts: A dictionary of dictionaries, where keys to the outer
          dictionary are ISO 639 language names (e.g. 'pt') or the special
          string TOTAL, used to indicate the total number of messages.  Keys
          of the inner dictionaries are prefixes (app names or "apps"), and
          values are their count for the given language.
  """
  def generateNumberAsPercent(num, total):
    percent = num * 100 / total
    if percent >= 90:
      color = 'green'
    elif percent >= 80:
      color = 'orange'
    elif percent >= 70:
      color = 'black'
    else:
      color = 'gray'
    return ('<font color="{!s}">{:.0f} ({:.0%})</font>'.format(color, num, num / total))
  apps = list(prefix_counts[TOTAL])
  apps.remove('ALL')
  apps.sort()
  apps.append('ALL')
  print('<html><body>')
  print('<script src="https://neil.fraser.name/'
        'software/tablesort/tablesort-min.js"></script>')
  print('<table cellspacing=5><thead><tr>')
  print('<th class=nocase>Language</th><th class=num>' +
        '</th><th class=num>'.join(apps) + '</th></tr></thead><tbody>')
  for lang in prefix_counts:
    if lang != TOTAL:
      print('<tr><td>' + lang + '</td>')
      for app in apps:
        print('<td>')
        print(generateNumberAsPercent(prefix_counts[lang].get(app, 0),
                                      prefix_counts[TOTAL][app]))
        print('</td>')
      print('</tr>')
  print('</tbody></table>')
  print('</body></html>')