'Create error reply basing on the received \'node\' stanza and the \'error\' error condition.
If the \'node\' is not the received stanza but locally created (\'to\' and \'from\' fields needs not swapping)
specify the \'reply\' argument as false.'

def __init__(self, node, error, reply=1):

    if reply:
        Protocol.__init__(self, to=node.getFrom(), frm=node.getTo(), node=node)
    else:
        Protocol.__init__(self, node=node)
    self.setError(error)
    if (node.getType() == 'error'):
        self.__str__ = self.__dupstr__
