def save_cookies(self, cookie_filter=None, default_expires=<NUM_LIT> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT:7>):
if not self.session or not self.cache:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>cookie_filter = cookie_filter or (lambda c: True)<EOL>saved = []<EOL>for cookie in filter(cookie_filter, self.session.http.cookies):<EOL><INDENT>cookie_dict = {}<EOL>for attr in ("<STR_LIT:version>", "<STR_LIT:name>", "<STR_LIT:value>", "<STR_LIT:port>", "<STR_LIT>", "<STR_LIT:path>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>cookie_dict[attr] = getattr(cookie, attr, None)<EOL><DEDENT>cookie_dict["<STR_LIT>"] = getattr(cookie, "<STR_LIT>", getattr(cookie, "<STR_LIT>", None))<EOL>expires = default_expires<EOL>if cookie_dict['<STR_LIT>']:<EOL><INDENT>expires = int(cookie_dict['<STR_LIT>'] - time.time())<EOL><DEDENT>key = "<STR_LIT>".format(cookie.name,<EOL>cookie.domain,<EOL>cookie.port_specified and cookie.port or "<STR_LIT>",<EOL>cookie.path_specified and cookie.path or "<STR_LIT:*>")<EOL>self.cache.set(key, cookie_dict, expires)<EOL>saved.append(cookie.name)<EOL><DEDENT>if saved:<EOL><INDENT>self.logger.debug("<STR_LIT>".format("<STR_LIT:U+002CU+0020>".join(saved)))<EOL><DEDENT>return saved<EOL>
Store the cookies from ``http`` in the plugin cache until they expire. The cookies can be filtered
by supplying a filter method. eg. ``lambda c: "auth" in c.name``. If no expiry date is given in the
cookie then the ``default_expires`` value will be used.

:param cookie_filter: a function to filter the cookies
:type cookie_filter: function
:param default_expires: time (in seconds) until cookies with no expiry will expire
:type default_expires: int
:return: list of the saved cookie names