def get_bit_num(bit_pattern):
if bit_pattern == <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>bit_num = <NUM_LIT:0>  <EOL>while (bit_pattern & <NUM_LIT:1>) == <NUM_LIT:0>:<EOL><INDENT>bit_pattern = bit_pattern >> <NUM_LIT:1><EOL>bit_num += <NUM_LIT:1><EOL>if bit_num > <NUM_LIT:7>:<EOL><INDENT>bit_num = <NUM_LIT:0><EOL>break<EOL><DEDENT><DEDENT>return bit_num<EOL>
Returns the lowest bit num from a given bit pattern. Returns None if no
    bits set.

    :param bit_pattern: The bit pattern.
    :type bit_pattern: int
    :returns: int -- the bit number
    :returns: None -- no bits set

    >>> pifacecommon.core.get_bit_num(0)
    None
    >>> pifacecommon.core.get_bit_num(0b1)
    0
    >>> pifacecommon.core.get_bit_num(0b11000)
    3