REF: extract method from _iterparse_nodes
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

While looking through the code I saw this function and thought it seemed too big and too complex (too many conditionals) for a single function. So I'm proposing refactoring it so it would be easier to understand what it does without having to look line by line.

@eduardostdasilva thanks for the PR, but it seems like there isn't consensus on moving forward with it.  If you think we should reconsider, please open an issue to discuss the matter.  Closing.