This should be be moved to the top of the file and use the following pattern:

```
try:
    import zeroconf
except ImportError:
    logging.warning(...)
    zeroconf = None
```

Then the code I'm commenting on simply does ``if zeroconf: ...``.