def newDocument(tag): impl = mdom.getDOMImplementation() dom = impl.createDocument(None, tag, None) return dom.documentElement