<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_cookie(self, key, value, domain=None, path='/', secure=False, httponly=True):
 """Set a cookie. Args: key (:obj:`str`):
 Cookie name value (:obj:`str`):
 Cookie value domain (:obj:`str`):
 Cookie domain path (:obj:`str`):
 Cookie value secure (:obj:`bool`):
 True if secure, False otherwise httponly (:obj:`bool`):
 True if it's a HTTP only cookie, False otherwise """

        self._cookies[key] = value
        if domain:
            self._cookies[key]['domain'] = domain
        if path:
            self._cookies[key]['path'] = path
        if secure:
            self._cookies[key]['secure'] = secure
        if httponly:
            self._cookies[key]['httponly'] = httponly