You should try-catch a possible problem here, something like:
```python
try:
    with open(path, "w") as f:
        f.write(client_cert)
except IOError, e:
    logger.error("Error saving cert file: %r" % (e, ))
```