code: def iv(base, counter):
      
      if (counter >> 64) != 0:
          raise ECEException(u"Counter too big")
      (mask,) = struct.unpack("!Q", base[4:])
      return base[:4] + struct.pack("!Q", counter ^ mask)
docs: Generate an initialization vector.