'Compare the JID to another instance or to string for equality.'

def __eq__(self, other):

    try:
        other = JID(other)
    except ValueError:
        return 0
    return ((self.resource == other.resource) and (self.__str__(0) == other.__str__(0)))
