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: wallet.rs
    path of file: ./repos/foundry/crates/wallets/src
    
    the code of the file until where you have to start completion: use crate::{raw_wallet::RawWalletOpts, utils, wallet_signer::WalletSigner};
use alloy_primitives::Address;
use clap::Parser;
use ethers_signers::Signer;
use eyre::Result;
use foundry_common::types::ToAlloy;
use serde::Serialize;

/// The wallet options can either be:
/// 1. Raw (via pr
    
    pub async fn signer(&self) -> Result<WalletSigner> {
        trace!("start finding signer");

        let signer = if self.ledger {
            utils::create_ledger_signer(self.raw.hd_path.as_deref(), self.raw.mnemonic_index)
                .await?
        } else if self.trezor {
            utils::create_trezor_signer(self.raw.hd_path.as_deref(), self.raw.mnemonic_index)
                .await?
        } else if self.aws {
            let key_id = std::env::var("AWS_KMS_KEY_ID")?;
            WalletSigner::from_aws(&key_id).await?
        } else if let Some(raw_wallet) = self.raw.signer()? {
            raw_wallet
        } else if let Some(path) = utils::maybe_get_keystore_path(
            self.keystore_path.as_deref(),
            self.keystore_account_name.as_deref(),
        )? {
            let (maybe_signer, maybe_pending) = utils::create_keystore_signer(
                &path,
                self.keystore_password.as_deref(),
                self.keystore_password_file.as_deref(),
            )?;
            if let Some(pending) = maybe_pending {
                pending.unlock()?
            } else if let Some(signer) = maybe_signer {
                signer
            } else {
                unreachable!()
            }
        } else {
            eyre::bail!(
                "\
Error accessing local wallet. Did you set a private key, mnemonic or keystore?
Run `cast send --help` or `forge create --help` and use the corresponding CLI
flag to set your key via:
--private-key, --mnemonic-path, --aws, --interactive, --trezor or --ledger.
Alternatively, if you're using a local node with unlocked accounts,
use the --unlocked flag and either set the `ETH_FROM` environment variable to the address
of the unlocked account you want to use, or provide the --from flag with the address directly."
            )
        };

        Ok(signer)
    }