title: Escape special characters in a Python string
body: <p>Does Python have a function that I can use to escape special characters in a string?</p>
  <p>For example, <code>I'm &quot;stuck&quot; :\</code> should become <code>I\'m \&quot;stuck\&quot; :\\</code>.</p>