def window(featurestream, seqid, start=None, end=None, strict=True):
region = None<EOL>if start and end:<EOL><INDENT>region = tag.Range(start, end)<EOL><DEDENT>for feature in featurestream:<EOL><INDENT>if feature.seqid != seqid:<EOL><INDENT>continue<EOL><DEDENT>if region:<EOL><INDENT>if strict:<EOL><INDENT>if region.contains(feature._range):<EOL><INDENT>yield feature<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if region.overlap(feature._range):<EOL><INDENT>yield feature<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>yield feature<EOL><DEDENT><DEDENT>
Pull features out of the designated genomic interval.

This function uses 0-based half-open intervals, not the 1-based closed
intervals used by GFF3.

:param featurestream: a stream of feature entries
:param seqid: ID of the sequence from which to select features
:param start: start of the genomic interval
:param end: end of the genomic interval
:param strict: when set to :code:`True`, only features completely contained
               within the interval are selected; when set to :code:`False`,
               any feature overlapping the interval is selected