from typing import Dict
from typing import Any


def validate_key(config_dict: Dict[str, Any], key: str, value_type: type, default: Any):
    """
    Returns config_dict[key] if the value exists and if of type value_type,
    otherwise returns a default value.
    """
    return (
        config_dict[key]
        if key in config_dict and isinstance(config_dict[key], value_type)
        else default
    )