import six


def _val_exp_loss_prem(x, y, z):
    """Takes three strings (or unicode) and cleans them
    for indexing an H2OFrame.

    Parameters
    ----------

    x : str
        exp name

    y : str
        loss name

    z : str
        premium name

    Returns
    -------

    out : tuple
        exp : str
            The name of the exp feature (``x``) 

        loss : str
            The name of the loss feature (``y``)

        prem : str or None
            The name of the prem feature (``z``)
    """
    if not all([isinstance(i, six.string_types) for i in (x, y)]):
        raise TypeError('exposure and loss must be strings or unicode')

    if z is not None:
        if not isinstance(z, six.string_types):
            raise TypeError('premium must be None or string or unicode')

    out = (str(x), str(y), str(z) if z is not None else z)
    return out