'Generate a Message object for sending to the relying party,
after encoding.'

def toMessage(self):

    namespace = self.openid_message.getOpenIDNamespace()
    reply = Message(namespace)
    reply.setArg(OPENID_NS, 'mode', 'error')
    reply.setArg(OPENID_NS, 'error', str(self))
    if (self.contact is not None):
        reply.setArg(OPENID_NS, 'contact', str(self.contact))
    if (self.reference is not None):
        reply.setArg(OPENID_NS, 'reference', str(self.reference))
    return reply
