def _set_kdf_iter(db_handle, kdf_iter=4000):
    """
    Set the number of iterations for the key derivation function.

    SQLCipher uses PBKDF2 key derivation to strengthen the key and make it
    resistent to brute force and dictionary attacks. The default
    configuration uses 4000 PBKDF2 iterations (effectively 16,000 SHA1
    operations). PRAGMA kdf_iter can be used to increase or decrease the
    number of iterations used.

    Implementation Notes:

    * PRAGMA kdf_iter must be called after PRAGMA key and before the first
        actual database operation or it will have no effect.

    * If a non-default value is used PRAGMA kdf_iter to create a database,
        it must also be called every time that database is opened.

    * It is not recommended to reduce the number of iterations if a
        passphrase is in use.

    :param db_handle: A handle to the SQLCipher database.
    :type db_handle: pysqlcipher.Connection
    :param kdf_iter: The number of iterations to use.
    :type kdf_iter: int
    """
    db_handle.cursor().execute("PRAGMA kdf_iter = '%d'" % kdf_iter)
