'Set the appropriate presence reply type.
Overrides StanzaBase.reply.
Arguments:
clear -- Indicates if the stanza contents should be removed
before replying. Defaults to True.'

def reply(self, clear=True):

    if (self['type'] == 'unsubscribe'):
        self['type'] = 'unsubscribed'
    elif (self['type'] == 'subscribe'):
        self['type'] = 'subscribed'
    return StanzaBase.reply(self, clear)
