title: Convert SQL blob/bytea in dump to string in Python
body: <p>I have a pg_dump of a table that contains a column of type bytea. It is a long string like: <code>\\x4e696365206d7573696361...</code></p>
  
  <p>Normally in SQL I would use a simple:</p>
  
  <pre><code>SELECT user_id,
         encode(text_column::bytea, 'escape')
  FROM posts
  LIMIT 10
  </code></pre>
  
  <p>And that provides the original text.</p>
  
  <p>How can I convert this in Python? I've been trying <code>.encode</code>/<code>.decode</code>/<code>base64encode</code> etc but no luck. </p>