this puts a literal `\n` inside the message. Instead, use something like

```python
            message = ("Received non string object (%s) as "
                       "key in mapping." % str(key))
```

Or, if you prefer,
```python
            message = "Received non string object (%s) as " \
                      "key in mapping." % str(key)
```
also works. Note that you close the quotes on the first line and reopen on the second, so the `\n` isn't inside the string.