[#1393] user_dictize: return apikey correctly

Was returning email instead of apikey. Fixes #1393
[#1392] more fixes from awful commit + tests
[#1392] pep8 fix