'Construct error response stanza.
The C{stanza} is transformed into an error response stanza by
swapping the C{to} and C{from} addresses and inserting an error
element.
@note: This creates a shallow copy of the list of child elements of the
stanza. The child elements themselves are not copied themselves,
and references to their parent element will still point to the
original stanza element.
The serialization of an element does not use the reference to
its parent, so the typical use case of immediately sending out
the constructed error response is not affected.
@param stanza: the stanza to respond to
@type stanza: L{domish.Element}'

def toResponse(self, stanza):

    from twisted.words.protocols.jabber.xmlstream import toResponse
    response = toResponse(stanza, stanzaType='error')
    response.children = copy.copy(stanza.children)
    response.addChild(self.getElement())
    return response
