1import math
2
3
4def _toFlagBits(value):
5    modifier = 1
6    bits = []
7    while value > 0:
8        if value & 1:
9            bits.append( int(math.log(modifier)/math.log(2)))
10        modifier = modifier << 1
11        value = value >> 1
12    return bits
13