def METHOD_NAME(self, pattern, comment_str='#'):
    """ Comments out all lines that match with pattern """
    for line in self.cfile.splitlines():
        if re.search(pattern, line):
            self.cfile = self.cfile.replace(line, comment_str + line)