def render(self, request):
                """
                Hook into response generation so that when rendering has
                finished completely (with or without error), C{logout} is
                called.
                """
                request.notifyFinish().addBoth(lambda ign: logout())
                return super(ResourceWrapper, self).render(request)

                Hook into response generation so that when rendering has
                finished completely (with or without error), C{logout} is
                called.
                
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/_auth/wrapper.py