do the test for `orderd is not None` before taking the time to calculate ordere

```
orderd = ...
if orderd is not None:
    ordere = ...
    if ordere == orderd:
        ...
```