<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def put(self, key, value, cache=None, options={}):
 """Query the server to set the key specified to the value specified in the specified cache. Keyword arguments: key -- the name of the key to be set. Required. value -- the value to set key to. Must be a string or JSON serialisable. Required. cache -- the cache to store the item in. Defaults to None, which uses self.name. If no name is set, raises a ValueError. options -- a dict of arguments to send with the request. See http://dev.iron.io/cache/reference/api/#put_item for more information on defaults and possible values. """

        if cache is None:
            cache = self.name
        if cache is None:
            raise ValueError("Cache name must be set")


        if not isinstance(value, str_type) and not isinstance(value, int_types):
            value = json.dumps(value)

        options["value"] = value
        body = json.dumps(options)

        cache = quote_plus(cache)
        key = quote_plus(key)

        result = self.client.put("caches/%s/items/%s" % (cache, key), body,
                {"Content-Type": "application/json"})
        return Item(cache=cache, key=key, value=value)