def copy_of_xml_element ( elem ) : copyElem = ElementTree . Element ( elem . tag , elem . attrib ) for child in elem : copyElem . append ( child ) return copyElem
python xml element copy
This method returns a shallow copy of a XML - Element . This method is for compatibility with Python 2 . 6 or earlier .. In Python 2 . 7 you can use copyElem = elem . copy () instead .
def copy_of_xml_element(elem):
    """
    This method returns a shallow copy of a XML-Element.
    This method is for compatibility with Python 2.6 or earlier..
    In Python 2.7 you can use  'copyElem = elem.copy()'  instead.
    """

    copyElem = ElementTree.Element(elem.tag, elem.attrib)
    for child in elem:
        copyElem.append(child)
    return copyElem