Cleaned up sections script

Turned most of the code in sections.py to snake_case and in the process
also extracted helper utilities and logger. The logger usage will need
to be applied to other files that don't use this new style yet.