rules = {}
failure = 'hard_failure'
rules[failure] = []
for row in rows:
#this is what people are referring to below. You left out the addition of the dictionary structure to the list.
rules[failure][row[0]] = {}
rules[failure][row[0]]['type 1'] = row[1]
rules[failure][row[0]]['type 2'] = row[2]

This is what I created based on how I understood the questions. I wasn't sure what to call the 'f_expr' and 'c_expr' since you never mention where you get those but I assume they are already know column names in a resultset or structure of some sort.

Well, I apologize for the confusion, I never claimed that code actually compiled, hence (pseudo). Arthur Thomas put me on the right track, here is slightly modified version. (Yes, now its a simply nested dictionary, 3 levels down)

Correct way to handle this on Stack Overflow is to edit your question to clarify the whole thing, rather than putting in an "answer" that may not be an answer. If this is really an answer, then accept it by clicking on the checkmark icon to the left. Otherwise people coming here later haven't got a clue what you're up to.
–
Peter HansenDec 13 '09 at 3:27