def write_cookie(cls, COOKIE_NAME, COOKIE_VALUE, path, expires=7200):
 time_expire = (datetime.now() + timedelta(seconds=expires))
 time_expire = time_expire.strftime('%a, %d-%b-%Y %H:%M:%S GMT')
 cls.response.headers.add_header('Set-Cookie', (((((((COOKIE_NAME + '=') + COOKIE_VALUE) + '; expires=') + str(time_expire)) + '; path=') + path) + '; HttpOnly'))
 return

def write_cookie ( cls , COOKIE_NAME , COOKIE_VALUE , path , expires = 7200 ) : time_expire = ( datetime . now ( ) + timedelta ( seconds = expires ) ) time_expire = time_expire . strftime ( '%a, %d-%b-%Y %H:%M:%S GMT' ) cls . response . headers . add_header ( 'Set-Cookie' , ( ( ( ( ( ( ( COOKIE_NAME + '=' ) + COOKIE_VALUE ) + '; expires=' ) + str ( time_expire ) ) + '; path=' ) + path ) + '; HttpOnly' ) ) return
write a cookie @path = could be a cls .