@staticmethod
def _getbits(value, start, length):
    """
        Return *length* bits from byte *value*, starting at position *start*.
        Behaviour is undefined for start < 0, length < 0 or start + length > 32.
        """
    mask = (4294967295 << 32 - length & 4294967295) >> start
    return (value & mask) >> 32 - length - start
