Say I have a dictionary like the following {1:'one',2:'two',4:'three',8:'four',16:'five', etc...} and I am given some numbers, say 22, 25, and 9. I want to determine the keys, powers of 2, that comprise the number. Ex. 22 = 16+4+2 25 = 16+8+1 9 = 8+1 ...etc... How do I get these keys?