def ensure_specification_cols_are_in_dataframe(specification, dataframe):
    """
    Checks whether each column in `specification` is in `dataframe`. Raises
    ValueError if any of the columns are not in the dataframe.

    Parameters
    ----------
    specification : OrderedDict.
        Keys are a proper subset of the columns in `data`. Values are either a
        list or a single string, "all_diff" or "all_same". If a list, the
        elements should be:
            - single objects that are in the alternative ID column of `data`
            - lists of objects that are within the alternative ID column of
              `data`. For each single object in the list, a unique column will
              be created (i.e. there will be a unique coefficient for that
              variable in the corresponding utility equation of the
              corresponding alternative). For lists within the
              `specification` values, a single column will be created for all
              the alternatives within the iterable (i.e. there will be one
              common coefficient for the variables in the iterable).
    dataframe : pandas DataFrame.
        Dataframe containing the data for the choice model to be estimated.

    Returns
    -------
    None.
    """
    # Make sure specification is an OrderedDict
    try:
        assert isinstance(specification, OrderedDict)
    except AssertionError:
        raise TypeError("`specification` must be an OrderedDict.")
    # Make sure dataframe is a pandas dataframe
    assert isinstance(dataframe, pd.DataFrame)

    problem_cols = []
    dataframe_cols = dataframe.columns
    for key in specification:
        if key not in dataframe_cols:
            problem_cols.append(key)
    if problem_cols != []:
        msg = "The following keys in the specification are not in 'data':\n{}"
        raise ValueError(msg.format(problem_cols))

    return None
Checks whether each column in `specification` is in `dataframe`. Raises
    ValueError if any of the columns are not in the dataframe.

    Parameters
    ----------
    specification : OrderedDict.
        Keys are a proper subset of the columns in `data`. Values are either a
        list or a single string, "all_diff" or "all_same". If a list, the
        elements should be:
            - single objects that are in the alternative ID column of `data`
            - lists of objects that are within the alternative ID column of
              `data`. For each single object in the list, a unique column will
              be created (i.e. there will be a unique coefficient for that
              variable in the corresponding utility equation of the
              corresponding alternative). For lists within the
              `specification` values, a single column will be created for all
              the alternatives within the iterable (i.e. there will be one
              common coefficient for the variables in the iterable).
    dataframe : pandas DataFrame.
        Dataframe containing the data for the choice model to be estimated.

    Returns
    -------
    None.