code: def interval_lengths( bits ):
      
      end = 0
      while 1:
          start = bits.next_set( end )
          if start == bits.size: break
          end = bits.next_clear( start )
          yield end - start
docs: Get the length distribution of all contiguous runs of set bits from