import warnings


def _handle_alias(X, Z):
    """Handle Z as an alias for X, return X/Z.

    Parameters
    ----------
    X: any object
    Z: any object

    Returns
    -------
    X if Z is None, Z if X is None

    Raises
    ------
    ValueError both X and Z are not None
    """
    if Z is None:
        return X
    elif X is None:
        msg = (
            "argument Z will in transformers is deprecated since version 0.10.0 "
            "and will be removed in version 0.11.0"
        )
        warnings.warn(msg, category=DeprecationWarning)
        return Z
    else:
        raise ValueError("X and Z are aliases, at most one of them should be passed")