This is actually not true, it's returning the DB representation of it as a dict, not the plugin wrapper object. As such, the u.id = None call two lines down, at least I'm pretty sure, will fail. I may be wrong, but without a unit test I'm skeptical that this runs.