title: Python Bitwise Operation function
body: <p>Can someone please explain what does this code do? I understand mostly what each bitwise operation does but I fail to see the full purpose of this code.</p>
  
  <pre><code>def get_bit(byte, bit_num):
      '''
      @param int byte: a given byte
      @param int bit_num: a specific bit number within the 
      @rtype: int
      &gt;&gt;&gt; get_bit(0b00000101, 2)
      1
      '''
      return (byte &amp; (1 &lt;&lt; bit_num)) &gt;&gt; bit_num
  </code></pre>