ATC listing script is importable

* tools/atc/email_stats.py: Move procedural code out of the global
scope to make this file safely importable, and clean up a couple of
unused variables flake8 noticed in the newly importable main
codeblock.

Change-Id: I1a29c84e067eea875ba57a16196723f65f60ff01
Merge "ATC listing script is importable"