Breadth First Search in Python