def METHOD_NAME(xml_file, subst, include_path, version=None):
    with open(xml_file) as f:
        content = f.read()
    for k, v in subst.items():
        content = content.replace(k, v)
    doc = xml.dom.minidom.parseString(content).documentElement
    xi_nodes = doc.getElementsByTagName("xi:include")
    for node in xi_nodes:
        fn = node.getAttribute("href")
        content = None
        for dir in include_path:
            try:
                with open("%s/%s" % (dir, fn)) as xi_f:
                    content = xi_f.read()
            except IOError:
                pass
        if not content:
            sys.stderr.write("%s: could not open include file %s\n"
                             % (argv0, fn))
            sys.exit(1)
        for k, v in subst.items():
            content = content.replace(k, v)
        xi_doc = xml.dom.minidom.parseString(content).documentElement
        doc.replaceChild(xi_doc, node)
    if version is None:
        version = "UNKNOWN"
    program = doc.attributes['program'].nodeValue
    title = doc.attributes['title'].nodeValue
    section = doc.attributes['section'].nodeValue
    # Putting '\" p as the first line tells "man" that the manpage
    # needs to be preprocessed by "pic".
    s = r''''\" p