from typing import Dict
import click


def prep_secrets(*, environment_mappings: Dict[str, str], secret_values: Dict[str, str]) -> Dict[str, str]:
    """Convert secrets from standardized name map to required environment variable map.

    :param dict environment_mappings: Mapping from secret identifiers to environment variable names
    :param dict secret_values: Mapping from secret identifiers to secret values
    :returns: Mapping from environment variable names to secret values
    :raises click.UsageError: if secrets contains an identifier that is not in environment_mappings
    """
    try:
        return {environment_mappings[key]: value for key, value in secret_values.items()}
    except KeyError as error:
        missing_key = error.args[0]
        raise click.UsageError(f'Identifier key "{missing_key}" not found in environment variable mapping.')