title: escape backslash in encoded data
body: <p>I have created a script which contains serial communication and DB connect for request.
  retrieve data from com port is ok, exec procedure also works fine.
  I have problem after data from DB are received. I need to send it to com port as an answer.</p>
  <p>Answer from script is <code>&quot;00000011D88A\x1b[2JSome text answer\x1b[1q\x1b[1q\x0d&quot;</code>.
  before it could be send to com port, the string has to be casted to bytearray.
  So I use <code>.encode()</code>. But then the string changed to: <code>&quot;00000011D88A\\x1b[2JSome text answer\\x1b[1q\\x1b[1q\\x0d&quot;</code>.</p>
  <p>How I have to cast the string to not change the meaning? I know that <code>&quot;\&quot;</code> is an escape character. But how to omit to use it, when the device need it?</p>