Return separately for each node tree type. This patch originally started as a refactor to change the logic of iterating through compositing node trees but we ended up choosing a different solution so only the small cleanup part is submitted here. Pull Request: https://projects.blender.org/blender/blender/pulls/138205