def output(checks):
    (yield '# HELP hc_check_up Whether the check is currently up (1 for yes, 0 for no).\n')
    (yield '# TYPE hc_check_up gauge\n')
    TMPL = 'hc_check_up{name="%s", tags="%s", unique_key="%s"} %d\n'
    for check in checks:
        value = (0 if (check.get_status() == 'down') else 1)
        (yield (TMPL % (esc(check.name), esc(check.tags), check.unique_key, value)))
    (tags_statuses, num_down) = _tags_statuses(checks)
    (yield '\n')
    (yield '# HELP hc_tag_up Whether all checks with this tag are up (1 for yes, 0 for no).\n')
    (yield '# TYPE hc_tag_up gauge\n')
    TMPL = 'hc_tag_up{tag="%s"} %d\n'
    for tag in sorted(tags_statuses):
        value = (0 if (tags_statuses[tag] == 'down') else 1)
        (yield (TMPL % (esc(tag), value)))
    (yield '\n')
    (yield '# HELP hc_checks_total The total number of checks.\n')
    (yield '# TYPE hc_checks_total gauge\n')
    (yield ('hc_checks_total %d\n' % len(checks)))
    (yield '\n')
    (yield '# HELP hc_checks_down_total The number of checks currently down.\n')
    (yield '# TYPE hc_checks_down_total gauge\n')
    (yield ('hc_checks_down_total %d\n' % num_down))
def output(checks):
    (yield '# HELP hc_check_up Whether the check is currently up (1 for yes, 0 for no).\n')
    (yield '# TYPE hc_check_up gauge\n')
    TMPL = 'hc_check_up{name="%s", tags="%s", unique_key="%s"} %d\n'
    for check in checks:
        value = (0 if (check.get_status() == 'down') else 1)
        (yield (TMPL % (esc(check.name), esc(check.tags), check.unique_key, value)))
    (tags_statuses, num_down) = _tags_statuses(checks)
    (yield '\n')
    (yield '# HELP hc_tag_up Whether all checks with this tag are up (1 for yes, 0 for no).\n')
    (yield '# TYPE hc_tag_up gauge\n')
    TMPL = 'hc_tag_up{tag="%s"} %d\n'
    for tag in sorted(tags_statuses):
        value = (0 if (tags_statuses[tag] == 'down') else 1)
        (yield (TMPL % (esc(tag), value)))
    (yield '\n')
    (yield '# HELP hc_checks_total The total number of checks.\n')
    (yield '# TYPE hc_checks_total gauge\n')
    (yield ('hc_checks_total %d\n' % len(checks)))
    (yield '\n')
    (yield '# HELP hc_checks_down_total The number of checks currently down.\n')
    (yield '# TYPE hc_checks_down_total gauge\n')
    (yield ('hc_checks_down_total %d\n' % num_down))