'Return an hex string with the correct bit set corresponding to the wanted fields in the map'

def _getBitChain(self, map, wanted):

    bit = 0
    for (index, field) in enumerate(map):
        if ((field in wanted) and (not (field in self.blacklist))):
            bit ^= (1 << ((len(map) - index) - 1))
    bit = str(bit).lstrip('0x').rstrip('L')
    bit = (''.join(['0' for unused in xrange(((len(map) / 4) - len(bit)))]) + bit)
    return bit
