From this quote on, Emacs syntax highlighting is in string mode. so 
code appears highlighted as a string.  For more info see: 
http://www.etsimo.uniovi.es/python/emacs/python-mode/faq.html

Anyway, I would contend that using a single quote for punctuation is 
much more common than having lone double-quotes in the text, and 
therefore a reasonable solution would be to use the tripple-double-quotes.
    

I don't know, if Emacs could cope with that, but I suspect, that this
could even do more harm. In literary text, you might have the
occacional single quote, but in Webware texts, double quotes are much
more common. I mean, we're dealing HTML here, where double quotes are
everywhere:
  
  self.writeln('''<input type="text" width="25" value="Quotes">''')

is nicer than this, IMO:

  self.writeln("""<input type="text" width="25" value="Quotes">""")

  
I think I am more intersted in it for doc strings where punctuation of fre-form text is more frequently used.  In the case of string literals such as your example, I am find the triple-single-quotes works just fine, and fails in fewer instances.

-Stuart-