code: def observe_lr(optimizer_name="main", observation_key="lr"):
      """Returns a trainer extension to record the learning rate.
  
      Args:
          optimizer_name (str): Name of optimizer whose learning rate is
              recorded.
          observation_key (str): Key of observation to record.
  
      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.
  
      """
      return observe_value(
          observation_key,
          lambda trainer: trainer.updater.get_optimizer(
              optimizer_name
          ).lr,
      )
  
label_desc: Use image node_id 2 for calling a global function with example usage: observe_lr(optimizer_name, observation_key) and returns: observe_value