Why not use `{name!r}` instead of `'{name}'`, and let Python do the quoting for you?