Iterates untill queue become empty
while len ( q ) != 0 : NEW_LINE INDENT node = q . popleft ( ) NEW_LINE if node . left is not None : NEW_LINE INDENT q . append ( node . left ) NEW_LINE DEDENT if node . right is not None : NEW_LINE INDENT q . append ( node . right ) NEW_LINE DEDENT DEDENT return node . data NEW_LINE