code: def observe_value(observation_key, target_func):
      """Returns a trainer extension to continuously record a value.
  
      Args:
          observation_key (str): Key of observation to record.
          target_func (function): Function that returns the value to record.
              It must take one argument: :class:~chainer.training.Trainer object.
      Returns:
          The extension function.
  
      This extension is triggered each epoch by default.
      To change this, use the ``trigger`` argument with the
      :meth:`Trainer.extend() <chainer.training.Trainer.extend>` method.
  
      """
  
      @extension.make_extension(
          trigger=(1, "epoch"), priority=extension.PRIORITY_WRITER
      )
      def _observe_value(trainer):
          trainer.observation[observation_key] = target_func(trainer)
  
      return _observe_value
  
label_desc: Use image node_id 1 for calling a global function with example usage: observe_value(observation_key, target_func) and returns: _observe_value