def replace_lines(regexer, handler, lines):
result = []<EOL>for line in lines:<EOL><INDENT>content = line.strip()<EOL>replaced = regexer.sub(handler, content)<EOL>result.append(line.replace(content, replaced, <NUM_LIT:1>))<EOL><DEDENT>return result<EOL>
Uses replacement handler to perform replacements on lines of text

    First we strip off all whitespace
    We run the replacement on a clean 'content' string
    Finally we replace the original content with the replaced version
    This ensures that we retain the correct whitespace from the original line