docs: def read_nodes(fname, filter_elem, nodefactory=Node, remove_comments=True):
      """
      Convert an XML file into a lazy iterator over Node objects
      satifying the given specification, i.e. a function element -> boolean.
  
      :param fname: file name of file object
      :param filter_elem: element specification
  
      In case of errors, add the file name to the error message.
      """
      try:
          for _, el in iterparse(fname, remove_comments=remove_comments):
              if filter_elem(el):
                  yield node_from_elem(el, nodefactory)
                  el.clear()  # save memory
      except Exception:
          etype, exc, tb = sys.exc_info()
          msg = str(exc)
          if not str(fname) in msg:
              msg = '%s in %s' % (msg, fname)
          raise_(etype, msg, tb)