'Return -1, 0, 1 if the object is smaller, equal, or greater than other.
Not in the mathematical sense. If the object is of a different type
from the "other" then their classes are ordered according to
the sorted_classes list.
Examples
>>> from sympy.abc import x, y
>>> x.compare(y)
-1
>>> x.compare(x)
0
>>> y.compare(x)
1'

def compare(self, other):

    if (self is other):
        return 0
    n1 = self.__class__
    n2 = other.__class__
    c = ((n1 > n2) - (n1 < n2))
    if c:
        return c
    st = self._hashable_content()
    ot = other._hashable_content()
    c = ((len(st) > len(ot)) - (len(st) < len(ot)))
    if c:
        return c
    for (l, r) in zip(st, ot):
        l = (Basic(*l) if isinstance(l, frozenset) else l)
        r = (Basic(*r) if isinstance(r, frozenset) else r)
        if isinstance(l, Basic):
            c = l.compare(r)
        else:
            c = ((l > r) - (l < r))
        if c:
            return c
    return 0
