More precisely match module names and multiline output

I believe this fixes issue #8844, but I am not a python programmer.
The previous code would fail on multiline output from a2enmod, as well as incorrectly match on module names. e.g. the output "Module notssl already enabled" would be matched for the name ssl.