code: def get_prime(bits):
      
      while True:
          num = random.randrange(2 ** (bits - 1), 2 ** bits)
          if Integer(str(num)).is_probably_prime():
              return num
docs: Creates (probable) prime number of given size
  
      :param bits: size of number to generate
      :return: prime number of given size