def regularWigIterator(fd, verbose=False, sortedby=None, scoreType=int):
if verbose:<EOL><INDENT>try:<EOL><INDENT>totalLines = linesInFile(fd)<EOL>pind = ProgressIndicator(totalToDo=totalLines,<EOL>messagePrefix="<STR_LIT>",<EOL>messageSuffix="<STR_LIT>" + getFDName(fd))<EOL><DEDENT>except AttributeError:<EOL><INDENT>sys.stderr.write("<STR_LIT>"<EOL>+ "<STR_LIT>")<EOL>verbose = False<EOL><DEDENT><DEDENT>chromsSeen = set()<EOL>prev = None<EOL>fh = openFD(fd)<EOL>for line in fh:<EOL><INDENT>if verbose:<EOL><INDENT>pind.done += <NUM_LIT:1><EOL>pind.showProgress()<EOL><DEDENT>line = line.strip()<EOL>if line == "<STR_LIT>":<EOL><INDENT>continue<EOL><DEDENT>e = parseWigString(line, scoreType=scoreType)<EOL>if prev is not None and sortedby is not None and e.chrom == prev.chrom:<EOL><INDENT>if sortedby == ITERATOR_SORTED_START and prev.start > e.start:<EOL><INDENT>raise WigIteratorError("<STR_LIT>" + fd.name<EOL>+ "<STR_LIT>"<EOL>+ str(prev) + "<STR_LIT>" + str(e))<EOL><DEDENT><DEDENT>if prev is not None and prev.chrom != e.chrom:<EOL><INDENT>if (sortedby == ITERATOR_SORTED_START) and(e.chrom in chromsSeen or prev.chrom > e.chrom):<EOL><INDENT>raise WigIteratorError("<STR_LIT>" + fd.name<EOL>+ "<STR_LIT>")<EOL><DEDENT>chromsSeen.add(e.chrom)<EOL><DEDENT>yield e<EOL>prev = e<EOL><DEDENT>
@param sortedBy: if not None, should be one of ITERATOR_SORTED_BY_START
                 indicating an order that the input stream must be
                 sorted in
@raise WigIteratorError: if sortedBy is set and stream is not sorted