Implementing Bfs In Python