code: def from_totient(public_key, totient):
          
          p_plus_q = public_key.n - totient + 1
          p_minus_q = isqrt(p_plus_q * p_plus_q - public_key.n * 4)
          q = (p_plus_q - p_minus_q) // 2
          p = p_plus_q - q
          if not p*q == public_key.n:
              raise ValueError('given public key and totient do not match.')
          return PaillierPrivateKey(public_key, p, q)
docs: given the totient, one can factorize the modulus
  
          The totient is defined as totient = (p - 1) * (q - 1),
          and the modulus is defined as modulus = p * q
  
          Args:
            public_key (PaillierPublicKey): The corresponding public
              key
            totient (int): the totient of the modulus
  
          Returns:
            the :class:`PaillierPrivateKey` that corresponds to the inputs
  
          Raises:
            ValueError: if the given totient is not the totient of the modulus
              of the given public key