human
Complete this python program:
def macro_usage():
assistant
#Here is the Python code you requested.

    """Get active macros, their source paths, and usage on site.
    Return is a dict with the case-sensitive macro name as key, and a dict as
    value with keys:
    * github_subpath - the subpath on GitHub
    * count - the number of pages the macro is used on
    * en_count - the number of English pages the macro is used on
    If there is no ElasticSearch server or it is misconfigured, then the
    counts will both be 0.
    """
    macro_paths = macro_sources()
    if (not macro_paths):
        return {}
    lowercase_names = {}
    macros = {}
    for (name, github_subpath) in macro_paths.items():
        macros[name] = {'github_subpath': github_subpath, 'count': 0, 'en_count': 0}
        lowercase_names[name.lower()] = name
    def annotate_counts(counts, count_type):
        'Record    document    counts    from    an    ElasticSearch    annotated    result.'
        for (lowercase_name, doc_count) in counts.items():
            try:
                name = lowercase_names[lowercase_name]
            except KeyError:
                pass
            else:
                macros[name][count_type] = doc_count
    try:
        all_counts = macro_page_count()
    except TransportError:
        return macros
    else:
        annotate_counts(all_counts, 'count')
    annotate_counts(macro_page_count('en-US'), 'en_count')
    return macros