def get_app_user(app, name):
 q = Queue()
 def get_user_id():
  user = find_user(app.db, name)
  q.put(user.id)
 app.io_loop.add_callback(get_user_id)
 user_id = q.get(timeout=2)
 return app.users[user_id]

def get_app_user ( app , name ) : q = Queue ( ) def get_user_id ( ) : user = find_user ( app . db , name ) q . put ( user . id ) app . io_loop . add_callback ( get_user_id ) user_id = q . get ( timeout = 2 ) return app . users [ user_id ]
get the user object from the main thread needed for access to the spawner .