def mask_comments(input):
 search_re = re.compile('(.*?)(#)(.*)')
 return [search_re.sub(comment_replace, line) for line in input]

def mask_comments ( input ) : search_re = re . compile ( '(.*?)(#)(.*)' ) return [ search_re . sub ( comment_replace , line ) for line in input ]
mask the quoted strings so we skip braces inside quoted strings .