Revision history [back]
If it's indented as above (under the 'def' not the preceding 'if') then it's not valid. I don't know if this is a side effect of having pasted it into here or not. I edited the question to add formatting without changing the text, but don't know if the text is what you had in the editor.