Better to do the format once, and do this in this if block:

```python
if ininstance(msg, basestring):
    msg = [None, msg]

if msg[0]:
    "write comment and line"
else:
    "write line only
```