def get_version(filename, version='<STR_LIT>'):
with open(filename) as infile:<EOL><INDENT>for line in infile:<EOL><INDENT>if line.startswith('<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>version = line.split("<STR_LIT:'>")[<NUM_LIT:1>]<EOL><DEDENT>except IndexError:<EOL><INDENT>pass<EOL><DEDENT>break<EOL><DEDENT><DEDENT><DEDENT>return version<EOL>
Read version as text to avoid machinations at import time.