def METHOD_NAME(self, value):
    # This property may not exist yet on the context.
    if not self.context.hasProperty("modal"):
        if base_hasattr(self.context, "modal"):
            # We cannot define a property when an attribute with the same
            # name already exists.
            delattr(self.context, "modal")
        self.context._setProperty("modal", value, "string")
    else:
        self.context._setPropValue("modal", value)