code: def cycle_outputs(tree, direction):
      
      direction = 1 if direction == "next" else -1
      outputs = [output for output in tree.root.children
                 if output.name != "__i3"]
      focus_idx = outputs.index(tree.root.focused_child)
      next_idx = (focus_idx + direction) % len(outputs)
      next_output = outputs[next_idx]
      return find_focusable(next_output)
docs: Cycle through directions