def get_summary(stype, tag, value=None, collection_key=None,
                break_if_exists=False):
    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.histogram_summary(tag, value)
        elif stype == "scalar":
            summ = tf.scalar_summary(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
Returns True if action could consume more arguments (i.e., its pattern is open).
dataset/ETHPy150Open tflearn/tflearn/tflearn/summaries.py/get_summary--crossover with--dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/packages/argcomplete/my_argparse.py/action_is_open