def CountFlowResultsByType(self, client_id, flow_id, cursor=None):
    """Returns counts of flow results grouped by result type."""
    query = ("SELECT type, COUNT(*) FROM flow_results "
             "FORCE INDEX (flow_results_by_client_id_flow_id_timestamp) "
             "WHERE client_id = %s AND flow_id = %s "
             "GROUP BY type")
    args = [db_utils.ClientIDToInt(client_id), db_utils.FlowIDToInt(flow_id)]

    cursor.execute(query, args)

    return dict(cursor.fetchall())