If command is not found, os_dep.command() will raise a ValueError but not return none. So I guess what you want is as below:
```
        try:
            img = os_dep.command("qemu-kvm")
        except ValueError:
            raise error.TestNAError("Cannot find qemu-kvm")
```