def METHOD_NAME(self, conn):
    """
    return the number of connection, categorized by their state:
    active, idle, idle in transaction, idle in transaction (aborted)
    """
    stmt = (
        select(self._stat_view.c.state, func.count())
        .select_from(self._stat_view)
        .group_by(self._stat_view.c.state)
    )
    results = conn.execute(stmt).fetchall()
    output_dict = {}
    for result in results:
        key = "Number of " + str(result[0]) + " connection"
        val = int(result[1])
        output_dict[key] = val
    return output_dict