def pairedWigIterator(inputStreams, mirror=False, mirrorScore=None,<EOL>ignoreScore=True, sortedby=ITERATOR_SORTED_END,<EOL>scoreType=int, verbose=False, debug=False):
<EOL>sortOrder = ["<STR_LIT>"]<EOL>if sortedby == ITERATOR_SORTED_START:<EOL><INDENT>sortOrder.append("<STR_LIT:start>")<EOL>sortOrder.append("<STR_LIT:end>")<EOL><DEDENT>elif sortedby == ITERATOR_SORTED_END:<EOL><INDENT>sortOrder.append("<STR_LIT:end>")<EOL>sortOrder.append("<STR_LIT:start>")<EOL><DEDENT>if not ignoreScore:<EOL><INDENT>sortOrder.append("<STR_LIT>")<EOL><DEDENT>keyFunc = attrgetter(*sortOrder)<EOL>def next_item(iterator):<EOL><INDENT>"""<STR_LIT>"""<EOL>try:<EOL><INDENT>return next(iterator)<EOL><DEDENT>except StopIteration:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>wIterators = [wigIterator(fh, verbose=verbose, sortedby=sortedby,<EOL>scoreType=scoreType) for fh in inputStreams]<EOL>elements = [next_item(it) for it in wIterators]<EOL>while True:<EOL><INDENT>assert(len(elements) >= <NUM_LIT:2>)<EOL>if None not in elements and len(set([keyFunc(x) for x in elements])) == <NUM_LIT:1>:<EOL><INDENT>yield [e for e in elements]<EOL>elements = [next_item(it) for it in wIterators]<EOL><DEDENT>else:<EOL><INDENT>minElement = min([x for x in elements if x is not None], key=keyFunc)<EOL>minIndices = [i for i in range(<NUM_LIT:0>, len(elements))<EOL>if elements[i] is not None and<EOL>keyFunc(elements[i]) == keyFunc(minElement)]<EOL>if mirror:<EOL><INDENT>score = minElement.score if mirrorScore is None else mirrorScore<EOL>yield [elements[i] if i in minIndices<EOL>else GenomicInterval(minElement.chrom, minElement.start,<EOL>minElement.end, None, score)<EOL>for i in range(<NUM_LIT:0>, len(elements))]<EOL><DEDENT>for index in minIndices:<EOL><INDENT>elements[index] = next_item(wIterators[index])<EOL><DEDENT><DEDENT>if reduce(lambda x, y: x and y, [e is None for e in elements]):<EOL><INDENT>break<EOL><DEDENT><DEDENT>
@summary: iterate over multiple wig streams, and yield a list of wig
          elements that match for each location (locations with 0 matching
          items are skipped)
@param inputStrams: TODO
@param mirror:      TODO
@param mirrorScore: TODO
@param ignoreScore: Don't consider score when determining if two elements
                    are equal
@param sortedby:    TODO
@param scoreType:   TODO
@param verbose:     TODO
@param debug:       TODO
@note: streams must be sorted -- sortedby parameter determines what sorting
       order will be acceptable