def interval_lengths( bits ):
    """
    Get the length distribution of all contiguous runs of set bits from
    """
    end = 0
    while 1:
        start = bits.next_set( end )
        if start == bits.size: break
        end = bits.next_clear( start )
        yield end - start
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
Get the length distribution of all contiguous runs of set bits from