title: How to convert bitarray to an integer in python
body: <p>Suppose I define some bitarray in python using the following code:</p>
  
  <pre><code>from bitarray import bitarray
  d=bitarray('0'*30)
  d[5]=1
  </code></pre>
  
  <p>How can I convert d to its integer representation?
  In addition, how can I perform manipulations such as <code>d&amp;(d+1)</code> with bitarrays? </p>