Minor syntax change:

```python
elif vm_details['state'].lower() not in ('running', 'active'):
```