Why wrap constants in a function? Some of the user and get_anon_session bits look more like a test setup. Isn't that really what this would be?