def extract_column(X, col_name):
    """Extract specified column from dataframe. """
    if col_name is None or col_name not in list(X.columns):
        return X, None
    w = X[col_name].copy()
    X = X.drop(col_name, axis=1)
    return X, w