Could just break here, right?  i.e. -
```python
if result:
    break
```