'Define a cookie to be sent via the outgoing HTTP headers'

def set_cookie(self, key, value='', max_age=None, expires=None, path='/', domain=None, secure=None, httponly=None):

    self.cookies[key] = value
    for (var_name, var_value) in [('max_age', max_age), ('path', path), ('domain', domain), ('secure', secure), ('expires', expires), ('httponly', httponly)]:
        if ((var_value is not None) and (var_value is not False)):
            self.cookies[key][var_name.replace('_', '-')] = var_value
