from bs4 import Tag, NavigableString

def clone(el):
    if isinstance(el, NavigableString):
        return type(el)(el)
copy = Tag(None, el.builder, el.name, el.namespace, el.nsprefix)
copy.attrs = dict(el.attrs)
for attr in ('can_be_empty_element', 'hidden'):
    setattr(copy, attr, getattr(el, attr))
for child in el.contents:
    copy.append(clone(child))
return copy
клонировать элемент с BeautifulSoup