<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_data(self, data, request=None, response=None, context=None):
 transform = self.transform if hasattr(transform, 'context'):
 self.transform.context = context """Runs the transforms specified on this endpoint with the provided data, returning the data modified"""

        if transform and not (isinstance(transform, type) and isinstance(data, transform)):
            if self._params_for_transform:
                return transform(data, **self._arguments(self._params_for_transform, request, response))
            else:
                return transform(data)
        return data