human
I wrote the below code

    def percent_or_100(num, denom):
        return (int(round(((num / float(denom)) * 100))) if denom else 100)
    def single_result(sql, params):
        'Return    the    first    column    of    the    first    row    returned    by    a    query.'
        cursor = _cursor()
        cursor.execute(sql, params)
        return cursor.fetchone()[0]
    total = Document.objects.filter(locale=settings.WIKI_DEFAULT_LANGUAGE, is_archived=False, current_revision__isnull=False, is_localizable=True, latest_localizable_revision__isnull=False)
    total = total.exclude(html__startswith=REDIRECT_HTML)
    if product:
        total = total.filter(products=product)
        has_forum = product.questions_locales.filter(locale=locale).exists()
    ignore_categories = [str(ADMINISTRATION_CATEGORY), str(NAVIGATION_CATEGORY), str(HOW_TO_CONTRIBUTE_CATEGORY)]
    if (product and (not has_forum)):
        ignore_categories.append(str(CANNED_RESPONSES_CATEGORY))
    total = total.exclude(category__in=ignore_categories)
    total_docs = total.filter(is_template=False).count()
    total_templates = total.filter(is_template=True).count()
    if product:
        extra_joins = PRODUCT_FILTER
        prod_param = (product.id,)
    else:
        extra_joins = ''
        prod_param = tuple()
    up_to_date_translation_count = ((((('SELECT    COUNT(*)    FROM    wiki_document    transdoc    INNER    JOIN    wiki_document    engdoc    ON    transdoc.parent_id=engdoc.id    INNER    JOIN    wiki_revision    curtransrev                    ON    transdoc.current_revision_id=curtransrev.id    ' + extra_joins) + 'WHERE    transdoc.locale=%s                    AND    engdoc.category    NOT    IN                                    (') + ','.join(ignore_categories)) + ')                AND    transdoc.is_template=%s                    AND    NOT    transdoc.is_archived                    AND    NOT    engdoc.is_archived                    AND    engdoc.latest_localizable_revision_id    IS    NOT    NULL                    AND   ...

What's a good function header?

Here's a good function header?
assistant
#Here's a good function header.

def l10n_overview_rows(locale, product=None):