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: wizard.rs
    path of file: ./repos/vpncloud/src
    
    the code of the file until where you have to start completion: use crate::{config::Config, crypto::Crypto, device, types::Mode};
use dialoguer::{theme::ColorfulTheme, Confirm, Input, MultiSelect, Password, Select};
use ring::aead;
use std::{collections::HashMap, fs, io, os::unix::fs::PermissionsExt, path::Path};

const MODE_SIMPLE: usize = 0;
const MODE_ADVANCED: usize = 1;
const MODE_EXPERT: usize = 2;

fn str_list(s: String) -> Vec<String> {
    if s.is_empty() {
        vec![]
    } else {
        s.split(',').map(|k| k.trim().to_string()).collect()
    }
}

fn str_opt(s: String) -> Option<String> {
    if s.is_empty() {
        None
    } else {
        Some(s)
    }
}

fn configure_connectivity(config: &mut Config, mode: usize, theme: &ColorfulTheme) -> Result<(), dialoguer::Error> {
    if mode >= MODE_ADVANCED {
        config.listen =
            Input::with_theme(theme).with_prompt("Listen address").default(config.listen.clone()).interact_text()?;
    }
    config.peers = str_list(

    
fn configure_device(config: &mut Config, mode: usize, theme: &ColorfulTheme) -> Result<(), dialoguer::Error> {
    if mode >= MODE_ADVANCED {
        config.device_type = match Select::with_theme(theme)
            .with_prompt("Device type")
            .items(&["Tun (IP based)", "Tap (Ethernet based)"])
            .default(if config.device_type == device::Type::Tun { 0 } else { 1 })
            .interact()?
        {
            0 => device::Type::Tun,
            1 => device::Type::Tap,
            _ => unreachable!(),
        }
    }
    if mode == MODE_EXPERT {
        config.device_name =
            Input::with_theme(theme).with_prompt("Device name").default(config.device_name.clone()).interact_text()?;
        config.device_path = str_opt(
            Input::with_theme(theme)
                .with_prompt("Device path (empty for default)")
                .default(config.device_path.as_ref().cloned().unwrap_or_default())
                .interact_text()?,
        );
        config.fix_rp_filter = Confirm::with_theme(theme)
            .with_prompt("Automatically fix insecure rp_filter settings")
            .default(config.fix_rp_filter)
            .interact()?;
        config.mode = match Select::with_theme(theme)
            .with_prompt("Operation mode")
            .items(&["Normal", "Router", "Switch", "Hub"])
            .default(match config.mode {
                Mode::Normal => 0,
                Mode::Router => 1,
                Mode::Switch => 2,
                Mode::Hub => 3,
            })
            .interact()?
        {
            0 => Mode::Normal,
            1 => Mode::Router,
            2 => Mode::Switch,
            3 => Mode::Hub,
            _ => unreachable!(),
        };
        if config.mode == Mode::Switch {
            config.switch_timeout = Input::with_theme(theme)
                .with_prompt("Switch timeout (in seconds")
                .default(config.switch_timeout)
                .interact_text()?;
        }
    }
    Ok(())
}