<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _cost_method(self, *args, **kwargs):
 """Calculate gradient component of the cost This method returns the l2 norm error of the difference between the original data and the data obtained after optimisation Returns ------- float gradient cost component """


        cost_val = 0.5 * np.linalg.norm(self.obs_data - self.op(args[0])) ** 2

        if 'verbose' in kwargs and kwargs['verbose']:
            print(' - DATA FIDELITY (X):', cost_val)

        return cost_val