(data,offset,bits=1)
return (data & mask) >> offset
Get specified bits from integer

        >>> bin(get_bits(0b0011100,2))
        '0b1'
        >>> bin(get_bits(0b0011100,0,4))
        '0b1100'
Get specified bits from integer
Get specified bits from integer
def get_bits(data,offset,bits=1):
    """
        Get specified bits from integer

        >>> bin(get_bits(0b0011100,2))
        '0b1'
        >>> bin(get_bits(0b0011100,0,4))
        '0b1100'
        
    """
    mask = ((1 << bits) - 1) << offset
    return (data & mask) >> offset
def get_bits ( data , offset , bits = 1 ) : mask = ( ( 1 << bits ) - 1 ) << offset return ( data & mask ) >> offset