code: def get_prime(bits, k=64):
      
      if bits % 8 != 0 or bits == 0:
          raise ValueError("bits must be >= 0 and divisible by 8")
      while True:
          n = int.from_bytes(os.urandom(bits // 8), "big")
          if is_prime(n, k):
              return n
docs: Return a random prime up to a certain length.
  
      This function uses random.SystemRandom.