This question, fundamentally, is about code becoming invalid because of other parts of the code. Protected question. To answer this question, you need to have at least 10 reputation on this site (not counting the association bonus). The reputation requirement helps protect this question from spam and non-answer activity.
Docstrings are another one to remember: docstrings are string literals too, and invalid \ sequences are invalid in docstrings too! Use r"""raw strings""" for docstrings if they must contain .