from typing import Any
from typing import Callable


def _validate_keystone_config(keystone: bool, value: Any, validator: Callable) -> bool:
    """Validate keystone configurations.

    Args:
        keystone (bool): is keystone enabled, true if so, false otherwise.
        value (Any): value to be validated.
        validator (Callable): function to validate configuration.

    Returns:
        bool: true if valid, false otherwise.
    """
    if not keystone:
        return True

    return validator(value)