You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: key.rs
    path of file: ./repos/stratisd/src/jsonrpc/client
    
    the code of the file until where you have to start completion: // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

use std::{fs::File, os::unix::io::AsRawFd};

use nix::unistd::{pipe, write};

use crate::{
    engine::KeyDescription,
    jsonrpc::client::utils::prompt_password,
    print_table,
    stratis::{StratisError, StratisResult},
};

pub fn key_set(key_desc: KeyDescription, keyfile_p
    
pub fn key_set(key_desc: KeyDescription, keyfile_path: Option<&str>) -> StratisResult<()> {
    let (changed, rc, rs) = match keyfile_path {
        Some(kp) => {
            let file = File::open(kp)?;
            do_request!(KeySet, key_desc; file.as_raw_fd())
        }
        None => {
            let password = prompt_password()?
                .ok_or_else(|| StratisError::Msg("Password provided was empty".to_string()))?;

            let (read_end, write_end) = pipe()?;
            write(write_end, password.as_bytes())?;
            do_request!(KeySet, key_desc; read_end)
        }
    };
    if rc != 0 {
        Err(StratisError::Msg(rs))
    } else if changed.is_none() {
        Err(StratisError::Msg(
            "The requested action had no effect".to_string(),
        ))
    } else {
        Ok(())
    }
}