code: def wrap(node, tag):
      
      wrap_node = node.ownerDocument.createElement(tag)
      parent = node.parentNode
      if parent:
          parent.replaceChild(wrap_node, node)
      wrap_node.appendChild(node)
      return wrap_node
docs: Wrap the given tag around a node.