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

        The Key will only be set if its current modify index matches the
        supplied Index

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

        The Key will only be set if its current modify index matches the
        supplied Index
        """
        self.append({
            "Verb": "cas",
            "Key": key,
            "Value": encode_value(value, flags, base64=True).decode("utf-8"),
            "Flags": flags,
            "Index": extract_attr(index, keys=["ModifyIndex", "Index"])
        })
        return self