code: def notebook_proxy(request, username):
      
      security_check(request, username)
  
      manager = get_notebook_manager(request)
      notebook_info = manager.get_context(username)
  
      if not notebook_info:
          raise HTTPInternalServerError("Apparently IPython Notebook daemon process is not running for {}".format(username))
  
      if 'http_port' not in notebook_info:
          raise RuntimeError("Notebook terminated prematurely before managed to tell us its HTTP port")
  
      return proxy_it(request, notebook_info["http_port"])
docs: Renders a IPython Notebook frame wrapper.
  
      Starts or reattachs ot an existing Notebook session.