'Django middleware hook for process responses'

def process_response(self, __, response):

    session_cookie_domain = configuration_helpers.get_value('SESSION_COOKIE_DOMAIN')
    if session_cookie_domain:
        def _set_cookie_wrapper(key, value='', max_age=None, expires=None, path='/', domain=None, secure=None, httponly=False):
            '\n                                                                Wrapper    function    for    set_cookie()    which    applies    SESSION_COOKIE_DOMAIN    override\n                                                                '
            if (key == configuration_helpers.get_value('SESSION_COOKIE_NAME', settings.SESSION_COOKIE_NAME)):
                domain = session_cookie_domain
            return response.set_cookie_wrapped_func(key, value, max_age=max_age, expires=expires, path=path, domain=domain, secure=secure, httponly=httponly)
        response.set_cookie_wrapped_func = response.set_cookie
        response.set_cookie = _set_cookie_wrapper
    return response
