<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clean(self):
 """Clean response."""

        if self.response.type == 'application/json':
            cleaned = copy.deepcopy(self.response.data)
            if self.cleaner is not None:
                cleaned = self.cleaner(cleaned)

            typed_response = {
                dict: DictResponse,
                int: IntResponse,
            }.get(type(cleaned), BaseResponse)
            self.response = typed_response.from_cleaned(self.response, cleaned)
        else:
            self.response = FileResponse(self.response.response)