<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply(self, method, *args, **kwargs):
 """Create a new image by applying a function to this image's data. Parameters method : :obj:`function` A function to call on the data. This takes in a ndarray as its first argument and optionally takes other arguments. It should return a modified data ndarray. args : arguments Additional args for method. kwargs : keyword arguments Additional keyword arguments for method. Returns ------- :obj:`Image` A new Image of the same type with new data generated by calling method on the current image's data. """

        data = method(self.data, *args, **kwargs)
        return type(self)(data.astype(self.type), self.frame)