I'm not sure what you're suggesting. You're saying line 2423 should look like 
     ```if group_parent == new_section_ref: ```
?

That would be a bit funny, wouldn't it, since new_section_ref is a ContentSection object, and group_parent is a ContentGroup parent entry?