I'd actually prefer to change this to do the following:

```python
kwargs = {'engine': engine}
if encoding is not None:
    kwargs['encoding'] = encoding
# later in ExcelWriter call
excel_writer = ExcelWriter(excel_writer, **kwargs)
```