'Deep clone of this element and children.
@param parent: An optional parent for the copied fragment.
@type parent: I{Element}
@return: A deep copy parented by I{parent}
@rtype: I{Element}'

def clone(self, parent=None):

    root = Element(self.qname(), parent, self.namespace())
    for a in self.attributes:
        root.append(a.clone(self))
    for c in self.children:
        root.append(c.clone(self))
    for item in self.nsprefixes.items():
        root.addPrefix(item[0], item[1])
    return root
