def file_iterator(filehandle, verbose=False):
if type(filehandle).__name__ == "<STR_LIT:str>":<EOL><INDENT>filehandle = open(filehandle)<EOL><DEDENT>if verbose:<EOL><INDENT>try:<EOL><INDENT>pind = ProgressIndicator(totalToDo=os.path.getsize(filehandle.name),<EOL>messagePrefix="<STR_LIT>",<EOL>messageSuffix="<STR_LIT>" +<EOL>filehandle.name)<EOL><DEDENT>except AttributeError:<EOL><INDENT>sys.stderr.write("<STR_LIT>" +<EOL>"<STR_LIT>")<EOL>verbose = False<EOL><DEDENT><DEDENT>for line in filehandle:<EOL><INDENT>line = line.rstrip('<STR_LIT:\n>')<EOL>if verbose:<EOL><INDENT>pind.done = filehandle.tell()<EOL>pind.showProgress()<EOL><DEDENT>if line == "<STR_LIT>":<EOL><INDENT>continue<EOL><DEDENT>yield line<EOL><DEDENT>
Iterate over a file and yield stripped lines. Optionally show progress.