code: def _copy_except__document(el: Element) -> Element:
      """Monkey-patch ```nodes.Element.copy``` to not copy the ``_document``
      attribute.
  
      xref: https://github.com/sphinx-doc/sphinx/issues/11116#issuecomment-1376767086
      """
      newnode = object.__new__(el.__class__)
      # set in Element.__init__()
      newnode.children = []
      newnode.rawsource = el.rawsource
      newnode.tagname = el.tagname
      # copied in Element.copy()
      newnode.attributes = {
          k: (
              v
              if k
              not in {"ids", "classes", "names", "dupnames", "backrefs"}
              else v[:]
          )
          for k, v in el.attributes.items()
      }
      newnode.line = el.line
      newnode.source = el.source
      return newnode
  
imports: from __future__ import annotations
  import contextlib
  import re
  import unicodedata
  from typing import TYPE_CHECKING, Any, Callable
  from docutils import nodes
  from sphinx import addnodes
  from sphinx.locale import __
  from sphinx.util import logging
label_desc: Use image node_id 26 for calling a global function with example usage: _copy_except__document(el) and returns: newnode