The use of `dir` here jumps out at me.
I think this can just be:

```
if order.stop:
    ...
```