title: TypeError: bad operand type for unary ~: 'bytes' : complement of a string of bytes
body: <p>I am trying to compute the complement of this bytes string:</p>
  <pre><code>bts = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01'
  </code></pre>
  <p>I have tried using the tilde <code>~bts</code> but I've got a  <code>TypeError: bad operand type for unary ~: 'bytes'</code>.</p>
  <p>I have also tried to use</p>
  <pre><code>import bitarray
  ~bitarray.bitarray(bts)
  </code></pre>
  <p>It seems to work but later I have to convert it to a bytes string again. So the only solution I came up with is the following:</p>
  <pre><code>bts2 = bytes([0 if b == 1 else 1 for b in bts])
  </code></pre>
  <p>Is there a better alternative to compute the complement?</p>