def _long_to_wide(data, data_type, date_col="date", other_data_types_to_drop=[], sort_by=None):
    """Convert a dataframe from long format to wide format.

    Parameters:
    data (pandas.DataFrame): The dataframe to convert.
    data_type (str): The name of the data type to keep when we pivot.
    date_col (str, optional): The name of the column with the dates in it. Default "date".
    other_data_types_to_drop (list of str, optional): A list of other data_type columns that may exist in the table, which will be dropped. Note that if data_type is included in this list, it will actually not be dropped.
    sort_by (str, optional): The name of one of the indexing columns to sort the dataframe by before returning it. Default of None causes no extra sorting to be performed.

    Returns:
    pandas.DataFrame: The dataframe in wide format.
    """
    # If there are multiple data type columns, only keep the one specified
    cols_to_drop = [col for col in other_data_types_to_drop if col != data_type and col in data.columns]
    data = data.drop(columns=cols_to_drop)

    # Spread the table, a la tidyr
    id_cols = [col for col in data.columns if col != data_type]
    data = data.set_index(id_cols) # Putting these in the index keeps them from being spread
    data = data.unstack(level=date_col, fill_value=0)
    data.columns = data.columns.droplevel(0)
    data.columns.name = None
    if sort_by is not None:
        data = data.sort_index(level=sort_by)
    data = data.reset_index() # Take the saved columns out of the index

    return data