code: def _bfs(node, visited):
      
      queue = collections.deque()
      queue.appendleft(node)
      while queue:
          node = queue.pop()
          if node not in visited:
              if node.lo is not None:
                  queue.appendleft(node.lo)
              if node.hi is not None:
                  queue.appendleft(node.hi)
              visited.add(node)
              yield node
docs: Iterate through nodes in BFS order.