code: def atlas_inventory_flip_zonefile_bits( inv_vec, bit_indexes, operation ):
      
      inv_list = list(inv_vec)
  
      max_byte_index = max(bit_indexes) / 8 + 1
      if len(inv_list) <= max_byte_index:
          inv_list += ['\0'] * (max_byte_index - len(inv_list))
  
      for bit_index in bit_indexes:
          byte_index = bit_index / 8
          bit_index = 7 - (bit_index % 8)
          
          zfbits = ord(inv_list[byte_index])
  
          if operation:
              zfbits = zfbits | (1 << bit_index)
          else:
              zfbits = zfbits & ~(1 << bit_index)
  
          inv_list[byte_index] = chr(zfbits)
  
      return "".join(inv_list)
docs: Given a list of bit indexes (bit_indexes), set or clear the
      appropriate bits in the inventory vector (inv_vec).
      If the bit index is beyond the length of inv_vec, 
      then expand inv_vec to accomodate it.
  
      If operation is True, then set the bits.
      If operation is False, then clear the bits
  
      Return the new inv_vec