code: def get_summary(
      stype, tag, value=None, collection_key=None, break_if_exists=False
  ):
      """get_summary.
  
      Create or retrieve a summary. It keep tracks of all graph summaries
      through summary_tags collection. If a summary tags already exists,
      it will return that summary tensor or raise an error (according to
      'break_if_exists').
  
      Arguments:
          stype: `str`. Summary type: 'histogram', 'scalar' or 'image'.
          tag: `str`. The summary tag (name).
          value: `Tensor`. The summary initialization value. Default: None.
          collection_key: `str`. If specified, the created summary will be
              added to that collection (optional).
          break_if_exists: `bool`. If True, if a summary with same tag already
              exists, it will raise an exception (instead of returning that
              existing summary).
  
      Returns:
          The summary `Tensor`.
  
      """
      summ = next(
          (
              item
              for item in tf.get_collection("summary_tags")
              if item["tag"] == tag
          ),
          None,
      )
  
      if not summ:
          if value is None:
              raise Exception(
                  "Summary doesn't exist, a value must be "
                  "specified to initialize it."
              )
          if stype == "histogram":
              summ = tf.summary.histogram(tag, value)
          elif stype == "scalar":
              summ = tf.summary.scalar(tag, value)
          elif stype == "image":
              pass  # TODO: create summary
          else:
              raise ValueError(
                  "Unknow summary type: '" + str(stype) + "'"
              )
          tf.add_to_collection(
              "summary_tags", {"tag": tag, "tensor": summ}
          )
          if collection_key:
              tf.add_to_collection(collection_key, summ)
      elif break_if_exists:
          raise ValueError(
              "Error: Summary tag already exists! (to ignore this "
              "error, set add_summary() parameter 'break_if_exists'"
              " to False)"
          )
      else:
          summ = summ["tensor"]
  
      return summ
  
file_path: tflearn/tflearn/summaries.py
imports: from __future__ import division, print_function, absolute_import
  import tensorflow.compat.v1
  from tensorflow.core.framework import summary_pb2
  from .utils import format_scope_name
label_desc: Use image node_id 2 for calling a global function with example usage: get_summary(stype, tag, value, collection_key, break_if_exists) and returns: summ