code: def get_learning_rate(train_config, global_step=None):
      """
      Get learning rate from train config.
  
      TODO: Better config usage.
  
      Returns:
          learning_rate: TensorFlow variable.
  
      Raises:
          ValueError: When the method used is not available.
      """
      lr_config = train_config.learning_rate.copy()
      decay_method = lr_config.pop("decay_method", None)
  
      if not decay_method or decay_method == "none":
          return lr_config.get("value") or lr_config.get(
              "learning_rate"
          )
  
      if decay_method not in LEARNING_RATE_DECAY_METHODS:
          raise ValueError(
              'Invalid learning_rate method "{}"'.format(decay_method)
          )
  
      if decay_method == "piecewise_constant":
          lr_config["x"] = global_step
      else:
          lr_config["global_step"] = global_step
  
      # boundaries, when used, must be the same type as global_step (int64).
      if "boundaries" in lr_config:
          lr_config["boundaries"] = [
              tf.cast(b, tf.int64) for b in lr_config["boundaries"]
          ]
  
      decay_function = LEARNING_RATE_DECAY_METHODS[decay_method]
      learning_rate = decay_function(**lr_config)
  
      tf.summary.scalar("losses/learning_rate", learning_rate)
  
      return learning_rate
  
imports: import tensorflow
  from luminoth.utils.vars import variable_summaries
label_desc: Use image node_id 1 for calling a global function with example usage: get_learning_rate(train_config, global_step) and returns: learning_rate, unknown