code: def make_pkey(key_type=crypto.TYPE_RSA, key_bits=4096):
    
    key = crypto.PKey()
    key.generate_key(key_type, key_bits)
    return key
docs: Make a public/private key pair.
  
    :param int key_type: The key type. For example,
      :class:`OpenSSL.crypto.TYPE_RSA`.
    :param int key_bits: The size of the key in bits.
    :return: A private key.
    :rtype: :class:`OpenSSL.crypto.PKey`