def remove_constant_columns(x_train, x_test=None):
    """
    Removes columns that have only one unique value.

    Parameters
    ----------
    x_train: Dataframe or array like - 2d
        Dataset
        
    x_test: Dataframe or array like - 2d
        Testing dataset, by default None.

    Returns
    -------
    Dataframe, *Dataframe
        Transformed dataframe with rows with a missing values in a specific row are missing

    Returns 2 Dataframes if x_test is provided.
    """
    keep_columns = list(filter(lambda x: x_train.nunique()[x] not in [0, 1],
        x_train.columns))
    x_train = x_train[keep_columns]
    if x_test is not None:
        x_test = x_test[keep_columns]
    return x_train, x_test
