<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def transform(self, X):
 """ Delete all features, which were not relevant in the fit phase. :param X: data sample with all features, which will be reduced to only those that are relevant :type X: pandas.DataSeries or numpy.array :return: same data sample as X, but with only the relevant features :rtype: pandas.DataFrame or numpy.array """

        if self.relevant_features is None:
            raise RuntimeError("You have to call fit before.")

        if isinstance(X, pd.DataFrame):
            return X.copy().loc[:, self.relevant_features]
        else:
            return X[:, self.relevant_features]