(self, a)
sqrt(a) found by the Tonelli–Shanks algorithm
        :param a: IntegersModuloPrimeElement
        :return: Output -1 if a is not a quadratic residue, otherwise the correct square roots (root, -root)
                Note root < self.mod / 2
sqrt(a) found by the Tonelli–Shanks algorithm
        :param a: IntegersModuloPrimeElement
        :return: Output -1 if a is not a quadratic residue, otherwise the correct square roots (root, -root)
                Note root < self.mod / 2
sqrt ( a ) found by the Tonelli–Shanks algorithm : param a : IntegersModuloPrimeElement : return : Output - 1 if a is not a quadratic residue otherwise the correct square roots ( root - root ) Note root < self . mod / 2
def sqrt(self, a):
        """
        sqrt(a) found by the Tonelli–Shanks algorithm
        :param a: IntegersModuloPrimeElement
        :return: Output -1 if a is not a quadratic residue, otherwise the correct square roots (root, -root)
                Note root < self.mod / 2
        """
        if type(a) != IntegersModuloPrimeElement:
            raise TypeError("Square root only supports an object")
        if self.is_a_quadratic_residue(a):
            root_raw = tonelli(a.val, self.mod)
            root_raw_other = self.mod - root_raw
            if root_raw < root_raw_other:
                return IntegersModuloPrimeElement(root_raw), IntegersModuloPrimeElement(root_raw_other)
            else:
                return IntegersModuloPrimeElement(root_raw_other), IntegersModuloPrimeElement(root_raw)
        else:
            return -1, -1
def sqrt ( self , a ) : if type ( a ) != IntegersModuloPrimeElement : raise TypeError ( "Square root only supports an object" ) if self . is_a_quadratic_residue ( a ) : root_raw = tonelli ( a . val , self . mod ) root_raw_other = self . mod - root_raw if root_raw < root_raw_other : return IntegersModuloPrimeElement ( root_raw ) , IntegersModuloPrimeElement ( root_raw_other ) else : return IntegersModuloPrimeElement ( root_raw_other ) , IntegersModuloPrimeElement ( root_raw ) else : return - 1 , - 1