class Node(object):

    def __init__(self, value, left=None, right=None):
        self.value = value
self.left = left
self.right = right

def traverse(rootnode):
    thislevel = [rootnode]
while thislevel:
    nextlevel = list()
for n in thislevel:
    print(n.value, end=' ')
if n.left:
    nextlevel.append(n.left)
if n.right:
    nextlevel.append(n.right)
print() 
thislevel = nextlevel
t = Node(1, Node(2, Node(4, Node(7))), Node(3, Node(5), Node(6)))
traverse(t)
Printing BFS (Binary Tree) in Level Order with _specific formatting_