def decompress_from_curve(self, x, flag):
        """
        calculate the y coordinate given only the x value.
        there are 2 possible solutions, use 'flag' to select.
        """

        cq = self.field.p
        x = self.field.value(x)

        ysquare = x ** 3 + self.a * x + self.b

        ysquare_root = sqrtCQ(ysquare.value, cq)

        bit0 = 0
        if ysquare_root % 2 is not 0:
            bit0 = 1

        if bit0 != flag:
            beta = (cq - ysquare_root) % cq
        else:
            beta = ysquare_root

        return self.point(x, beta)
calculate the y coordinate given only the x value.
        there are 2 possible solutions, use 'flag' to select.