Please move this block, plus line 33 (`request.addfinalizer(fin)`) to the bottom of the method , right before `return request.new_user` as I think that's clearer. It's a bit confusing to have this method defined in the middle of the `new_user` method.