use

```python
if cmd is not None:
```