FIxes for nodegroups/log_granular_levels settings and small cleanups

The first commit is a bugfix concerning the way we handle the nodegroups/log_granular_levels settings. The second commit is just a small cleanup for better Python 3 compatibility (and for consistency since both methods were already in use in this formula).