def almosteq(p1, p2, tolerance=None):
        ring = p1.ring

        if isinstance(p2, ring.dtype):
            if set(p1.keys()) != set(p2.keys()):
                return False

            almosteq = ring.domain.almosteq

            for k in p1.keys():
                if not almosteq(p1[k], p2[k], tolerance):
                    return False
            else:
                return True
        elif len(p1) > 1:
            return False
        else:
            try:
                p2 = ring.domain.convert(p2)
            except CoercionFailed:
                return False
            else:
                return ring.domain.almosteq(p1.const(), p2, tolerance)
Parse the data from a pty-req request into usable data.
dataset/ETHPy150Open sympy/sympy/sympy/polys/rings.py/PolyElement.almosteq--crossover with--dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/conch/ssh/session.py/parseRequest_pty_req