code: def _imagpart(self, f):
          
          def f_im(x, **kwargs):
              result = np.asarray(f(x, **kwargs),
                                  dtype=self.scalar_out_dtype)
              return result.imag
  
          if is_real_dtype(self.out_dtype):
              return self.zero()
          else:
              return self.real_space.element(f_im)
docs: Function returning the imaginary part of the result from ``f``.