<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cycle_outputs(tree, direction):
 """ Cycle through directions """

    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)