def summarize_cag_taxa(cag_id, cag_tax_df, taxa_rank):
    """Helper function to summarize the top hit at a given rank."""

    # If there are no hits at this level, return None
    if cag_tax_df is None:
        return {
            "CAG": cag_id,
            "name": 'none',
            "label": "No genes assigned at this level"
        }

    # Return the top hit
    return {
        "CAG": cag_id,
        "name": cag_tax_df["name"].values[0],
        "label": "{}<br>{:,} genes assigned".format(
            cag_tax_df["name"].values[0],
            int(cag_tax_df["count"].values[0])
        )
    }