import re


def comment_modules(modules, content):
    """
    Disable modules in file content by commenting them.
    """
    for module in modules:
        content = re.sub(
            r'^([ \t]*[^#\s]+.*{0}\.so.*)$'.format(module),
            r'#\1',
            content,
            flags=re.MULTILINE
        )

    return content