def raise_if_not(
    condition: bool,
    message: str = "",
    logger: logging.Logger = get_logger("main_logger"),
):
    """
    Checks provided boolean condition and raises a ValueError if it evaluates to False.
    It logs the error to the provided logger before raising it.

    Parameters
    ----------
    condition
        The boolean condition to be checked.
    message
        The message of the ValueError.
    logger
        The logger instance to log the error message if 'condition' is False.

    Raises
    ------
    ValueError
        if `condition` is not satisfied
    """

    if not condition:
        logger.error("ValueError: " + message)
        raise ValueError(message)

    Checks provided boolean condition and raises a ValueError if it evaluates to False.
    It logs the error to the provided logger before raising it.

    Parameters
    ----------
    condition
        The boolean condition to be checked.
    message
        The message of the ValueError.
    logger
        The logger instance to log the error message if 'condition' is False.

    Raises
    ------
    ValueError
        if `condition` is not satisfied
    
darts/logging.py