code: def _nodes(output, parent=None):
      
      # NOTE refactor so all outputs behave the same
      entity = getattr(output, 'entity', output)
  
      if isinstance(entity, Collection):
          for member in entity.members:
              if parent is not None:
                  member = attr.evolve(member, parent=parent)
              yield from _nodes(member)
          yield output
      else:
          yield output
docs: Yield nodes from entities.