def stats(**kwargs):
    """
    Helper that defines some useful statistics about destinations.

    :param kwargs:
    :return:
    """
    items = (
        database.db.session.query(
            Destination.label,
            func.count(certificate_destination_associations.c.certificate_id),
        )
        .join(certificate_destination_associations)
        .group_by(Destination.label)
        .all()
    )

    keys = []
    values = []
    for key, count in items:
        keys.append(key)
        values.append(count)

    return {"labels": keys, "values": values}

    Helper that defines some useful statistics about destinations.

    :param kwargs:
    :return:
    
lemur/destinations/service.py