Instead of fields.setdefault, maybe check "attr_name in fields" and continue?  That would save you getting the value just to have setdefault ignore it.