Python Code For Bfs Traversal Question