Mastering Breadth First Search in Python (with Working Code)