code: def newKey(a, b, k):
      
      try:
          p = findAPrime(a, b, k)
          while True:
              q = findAPrime(a, b, k)
              if q != p:
                  break
      except:
          raise ValueError
  
      n = p * q
      m = (p - 1) * (q - 1)
  
      while True:
          e = random.randint(1, m)
          if coPrime([e, m]):
              break
  
      d = modInv(e, m)
      return (n, e, d)
docs: Try to find two large pseudo primes roughly between a and b.
      Generate public and private keys for RSA encryption.
      Raises ValueError if it fails to find one