<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _dynamic_operation(self, map_obj):
 """ Generate function to dynamically apply the operation. Wraps an existing HoloMap or DynamicMap. """

        if not isinstance(map_obj, DynamicMap):
            def dynamic_operation(*key, **kwargs):
                kwargs = dict(self._eval_kwargs(), **kwargs)
                obj = map_obj[key] if isinstance(map_obj, HoloMap) else map_obj
                return self._process(obj, key, kwargs)
        else:
            def dynamic_operation(*key, **kwargs):
                kwargs = dict(self._eval_kwargs(), **kwargs)
                return self._process(map_obj[key], key, kwargs)
        if isinstance(self.p.operation, Operation):
            return OperationCallable(dynamic_operation, inputs=[map_obj],
                                     link_inputs=self.p.link_inputs,
                                     operation=self.p.operation)
        else:
            return Callable(dynamic_operation, inputs=[map_obj],
                            link_inputs=self.p.link_inputs)