def keep_intersection_of_columns(train, test):
    """ Remove the columns from test and train set that are not in
        both datasets.

    params
    ------
    train: pd.DataFrame containing the train set.
    test: pd.DataFrame containing the test set.

    return
    ------
    train and test where train.columns==test.columns by
    keeping only columns that were present in both datasets.
    """
    shared_cols = list(set(train.columns).intersection(set(test.columns)))
    return train[shared_cols], test[shared_cols]