def __eq__(self, other):
        """ Compare the JID to another instance or to string for equality. """
        try: other=JID(other)
        except ValueError: return 0
        return self.resource==other.resource and self.__str__(0) == other.__str__(0)
 Compare the JID to another instance or to string for equality. 
chrome-cordova/gcmServer/xmpp/protocol.py