code: def extract_page_xmls(f):
      """Extract pages from a MediaWiki database dump.
  
      Parameters
      ----------
      f : file
          File descriptor of MediaWiki dump.
  
      Yields
      ------
      str
          XML strings for page tags.
  
      """
      elems = (
          elem for _, elem in ElementTree.iterparse(f, events=("end",))
      )
  
      elem = next(elems)
      namespace = get_namespace(elem.tag)
      ns_mapping = {"ns": namespace}
      page_tag = "{%(ns)s}page" % ns_mapping
  
      for elem in elems:
          if elem.tag == page_tag:
              yield ElementTree.tostring(elem)
              # Prune the element tree, as per
              # http://www.ibm.com/developerworks/xml/library/x-hiperfparse/
              # except that we don't need to prune backlinks from the parent
              # because we don't use LXML.
              # We do this only for <page>s, since we need to inspect the
              # ./revision/text element. The pages comprise the bulk of the
              # file, so in practice we prune away enough.
              elem.clear()
  
file_path: gensim/gensim/scripts/segment_wiki.py
imports: import argparse
  import json
  import logging
  import multiprocessing
  import re
  import sys
  from xml.etree import ElementTree
  from functools import partial
  from gensim.corpora.wikicorpus import IGNORED_NAMESPACES, WikiCorpus, filter_wiki, find_interlinks, get_namespace, utils
  import gensim.utils
label_desc: Use image node_id 3 for calling a global function with example usage: extract_page_xmls(f) without return types