Avoiding reading configuration file multiple times. Using more 'pythonic' way to read file.