def predictors_validate(predictors, data=None):
    """Validates the predictors and ensures that they are type list(str)

    Optionally checks that the predictors are columns in the data set. Only
    performs this check if the data parameter is not None

    Parameters
    ----------
    predictors: list(str) or str
        the predictor(s) to validate
    data : pd.DataFrame or None, optional
        the data set to validate the predictors are in

    Returns
    -------
    list(str)
        validated predictors

    Raises
    ------
    ValueError
        if a predictor is named 'all' or 'none'
        if a predictor is not a column in the data set

    Examples
    --------
    >>> predictors_validate('famhistory')
    ['famhistory']
    >>> predictors_validate(['famhistory', 'marker'])
    ['famhistory', 'marker']
    >>> predictors_validate('all')
    Traceback (most recent call last):
      ...
    ValueError: predictor cannot be named 'all' or 'none'
    """
    if isinstance(predictors, str):  # single predictor
        predictors = [predictors]  #convert to list

    #cant't use 'all' or 'none' columns as predictors
    for predictor in predictors:
        if predictor in ['all', 'none']:
            raise ValueError("predictor cannot be named 'all' or 'none'")

    #check that predictors are columns in the data
    if data is not None:
        for predictor in predictors:
            if predictor not in data.columns:
                raise ValueError("predictor must be a column in the dataframe")
    else:
        pass  # skip check

    return predictors