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: diem.rs
    path of file: ./repos/diem/types/src/account_config/constants
    
    the code of the file until where you have to start completion: // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0

use crate::account_config::constants::CORE_CODE_ADDRESS;
use anyhow::{bail, ensure, Result};
use move_core_types::{
    identifier::{IdentStr, Identifier},
    language_storage::{ModuleId, StructTag, TypeTag},
};
use once_cell::sync::Lazy;

pub use move_core_types::vm_status::known_locations::{DIEM_MODULE, DIEM_MODULE_IDENTIFIER};

const COIN_MODULE_IDENTIFIER: &IdentStr = DIEM_MODULE_IDENTIFIER;
pub static COIN_MODULE: Lazy<ModuleId> =
    Lazy::n
    
pub fn currency_code_from_type_tag(type_tag: TypeTag) -> Result<Identifier> {
    let struct_tag = match type_tag {
        TypeTag::Struct(struct_tag) => struct_tag,
        _ => bail!(
            "expected a type for a currency struct, received: {:?}",
            type_tag
        ),
    };

    ensure!(
        struct_tag.address == CORE_CODE_ADDRESS
            && struct_tag.module == struct_tag.name
            && struct_tag.type_params.is_empty(),
        "not a valid currency struct tag: {:?}",
        struct_tag,
    );

    let currency_code = struct_tag.name;

    ensure!(
        allowed_currency_code_string(currency_code.as_str()),
        "currency code can only contain uppercase alphanumeric characters: '{}'",
        currency_code,
    );

    Ok(currency_code)
}