def genericFileIterator(fn, verbose=False):
if type(fn).__name__ == "<STR_LIT:str>":<EOL><INDENT>fh = open(fn)<EOL><DEDENT>else:<EOL><INDENT>fh = fn<EOL><DEDENT>if verbose:<EOL><INDENT>try:<EOL><INDENT>pind = ProgressIndicator(totalToDo=os.path.getsize(fh.name),<EOL>messagePrefix="<STR_LIT>",<EOL>messageSuffix="<STR_LIT>" + fh.name)<EOL>junk = fh.tell()<EOL><DEDENT>except:<EOL><INDENT>sys.stderr.write("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>verbose = False<EOL><DEDENT><DEDENT>for line in fh:<EOL><INDENT>if verbose:<EOL><INDENT>pind.done = fh.tell()<EOL>pind.showProgress()<EOL><DEDENT>line = line.strip()<EOL>if line == "<STR_LIT>":<EOL><INDENT>continue<EOL><DEDENT>yield line<EOL><DEDENT>
@summary: iterate over a file, returning non-blank lines
@param fn: either a string representing the name of the file or a file
           object
@param verbose: if True, output status messages to stderr