docs: async def cas(self, key, value, *, flags=None, index):
          """Sets the key to the given value with check-and-set semantics.
  
          Parameters:
              key (str): Key to set
              value (Payload): Value to set, It will be encoded by flags
              index (ObjectIndex): Index ID
              flags (int): Flags to set with value
          Response:
              bool: ``True`` on success
  
          The Key will only be set if its current modify index matches
          the supplied Index
  
          If the index is 0, Consul will only put the key if it does not already
          exist. If the index is non-zero, the key is only set if the index
          matches the ModifyIndex of that key.
          """
          value = encode_value(value, flags)
          index = extract_attr(index, keys=["ModifyIndex", "Index"])
          response = await self._write(key, value, flags=flags, cas=index)
          return response.body is True