from typing import Union
from typing import Tuple
from typing import Dict
from typing import Any


def _prepare_condition(params: Union[Tuple, Dict[str, Any]]) -> Tuple:
    """Converts provided parameters to Tuple.

    Parameters
    -----------
    params: (Union[Tuple, Dict[str, Any]])
        The condition which will be used to register a new validator.

    Returns
    -------
    Tuple
        Prepared condition.

    Raises
    ------
    ValueError
        If condition not provided or provided in the wrong format.
    """
    if not params:
        raise ValueError("Condition not provided.")
    if not isinstance(params, (dict, tuple)):
        raise ValueError(
            "Wrong format for the condition. Condition should be dict or list."
        )
    if not isinstance(params, tuple):
        return tuple((key, params[key]) for key in params)
    return params