import warnings


def ensure_all_columns_are_used(num_vars_accounted_for,
                                dataframe,
                                data_title='long_data'):
    """
    Ensure that all of the columns from dataframe are in the list of used_cols.
    Will raise a helpful UserWarning if otherwise.

    Parameters
    ----------
    num_vars_accounted_for : int.
        Denotes the number of variables used in one's function.
    dataframe : pandas dataframe.
        Contains all of the data to be converted from one format to another.
    data_title : str, optional.
        Denotes the title by which `dataframe` should be referred in the
        UserWarning.

    Returns
    -------
    None.
    """
    dataframe_vars = set(dataframe.columns.tolist())
    num_dataframe_vars = len(dataframe_vars)

    if num_vars_accounted_for == num_dataframe_vars:
        pass

    elif num_vars_accounted_for < num_dataframe_vars:
        msg = "Note, there are {:,} variables in {} but the inputs"
        msg_2 = " ind_vars, alt_specific_vars, and subset_specific_vars only"
        msg_3 = " account for {:,} variables."

        warnings.warn(msg.format(num_dataframe_vars, data_title) +
                      msg_2 + msg_3.format(num_vars_accounted_for))

    else:  # This means num_vars_accounted_for > num_dataframe_vars
        msg = "There are more variable specified in ind_vars, "
        msg_2 = "alt_specific_vars, and subset_specific_vars ({:,}) than there"
        msg_3 = " are variables in {} ({:,})"
        warnings.warn(msg +
                      msg_2.format(num_vars_accounted_for) +
                      msg_3.format(data_title, num_dataframe_vars))

    return None