def atlas_inventory_count_missing( inv1, inv2 ):
    """
    Find out how many bits are set in inv2 
    that are not set in inv1.
    """
    count = 0
    common = min(len(inv1), len(inv2))
    for i in xrange(0, common):
        for j in xrange(0, 8):
            if ((1 << (7 - j)) & ord(inv2[i])) != 0 and ((1 << (7 - j)) & ord(inv1[i])) == 0:
                count += 1

    if len(inv1) < len(inv2):
        for i in xrange(len(inv1), len(inv2)):
            for j in xrange(0, 8):
                if ((1 << (7 - j)) & ord(inv2[i])) != 0:
                    count += 1

    return count
Find out how many bits are set in inv2 
    that are not set in inv1.