code: def lock(self, key, value, *, flags=None, session):
          
          self.append({
              "Verb": "lock",
              "Key": key,
              "Value": encode_value(value, flags, base64=True).decode("utf-8"),
              "Flags": flags,
              "Session": extract_attr(session, keys=["ID"])
          })
          return self
docs: Locks the Key with the given Session
  
          Parameters:
              key (str): Key to set
              value (Payload): Value to set, It will be encoded by flags
              session (ObjectID): Session ID
  
          The Key will only be set if its current modify index matches the
          supplied Index