graphing_modules['matplotlib'] = matplotlib_naarad can be in try block. No need for else.