'Read from ``stream`` until we find at least one element that
matches ``tagspec``, and return the result of applying
``elt_handler`` to each element found.'

def read_block(self, stream, tagspec=None, elt_handler=None):

    if (tagspec is None):
        tagspec = self._tagspec
    if (elt_handler is None):
        elt_handler = self.handle_elt
    context = list(self._tag_context.get(stream.tell()))
    assert (context is not None)
    elts = []
    elt_start = None
    elt_depth = None
    elt_text = u''
    while ((elts == []) or (elt_start is not None)):
        if isinstance(stream, SeekableUnicodeStreamReader):
            startpos = stream.tell()
        xml_fragment = self._read_xml_fragment(stream)
        if (not xml_fragment):
            if (elt_start is None):
                break
            else:
                raise ValueError(u'Unexpected    end    of    file')
        for piece in self._XML_PIECE.finditer(xml_fragment):
            if self._DEBUG:
                print((u'%25s    %s' % (u'/'.join(context)[(-20):], piece.group())))
            if piece.group(u'START_TAG'):
                name = self._XML_TAG_NAME.match(piece.group()).group(1)
                context.append(name)
                if (elt_start is None):
                    if re.match(tagspec, u'/'.join(context)):
                        elt_start = piece.start()
                        elt_depth = len(context)
            elif piece.group(u'END_TAG'):
                name = self._XML_TAG_NAME.match(piece.group()).group(1)
                if (not context):
                    raise ValueError((u'Unmatched    tag    </%s>' % name))
                if (name != context[(-1)]):
                    raise ValueError((u'Unmatched    tag    <%s>...</%s>' % (context[(-1)], name)))
                if ((elt_start is not None) and (elt_depth == len(context))):
                    elt_text += xml_fragment[elt_start:piece.end()]
                    elts.append((elt_text, u'/'.join(context)))
                    elt_start = elt_depth = None
                    elt_text = u''
                context.pop()
            elif piece.group(u'EMPTY_ELT_TAG'):
                name = self._XML_TAG_NAME.match(piece.group()).group(1)
                if (elt_start is None):
                    if re.match(tagspec, ((u'/'.join(context) + u'/') + name)):
                        elts.append((piece.group(), ((u'/'.join(context) + u'/') + name)))
        if (elt_start is not None):
            if (elts == []):
                elt_text += xml_fragment[elt_start:]
                elt_start = 0
            else:
                if self._DEBUG:
                    print(((u'    ' * 36) + u'(backtrack)'))
                if isinstance(stream, SeekableUnicodeStreamReader):
                    stream.seek(startpos)
                    stream.char_seek_forward(elt_start)
                else:
                    stream.seek((- (len(xml_fragment) - elt_start)), 1)
                context = context[:(elt_depth - 1)]
                elt_start = elt_depth = None
                elt_text = u''
    pos = stream.tell()
    if (pos in self._tag_context):
        assert (tuple(context) == self._tag_context[pos])
    else:
        self._tag_context[pos] = tuple(context)
    return [elt_handler(ElementTree.fromstring(elt.encode(u'ascii', u'xmlcharrefreplace')), context) for (elt, context) in elts]
