code: def get_op_or_tensor_by_name(name):
      """
      Get either tf.Operation of tf.Tensor from names.
  
      Args:
          name (list[str] or str): names of operations or tensors.
  
      Raises:
          KeyError, if the name doesn't exist
      """
      G = tfv1.get_default_graph()
  
      def f(n):
          if len(n) >= 3 and n[-2] == ":":
              return G.get_tensor_by_name(n)
          else:
              return G.get_operation_by_name(n)
  
      if not isinstance(name, list):
          return f(name)
      else:
          return list(map(f, name))
  
file_path: tensorpack/tensorpack/tfutils/common.py
imports: import tensorflow
  from ..compat import tfv1
  from ..utils.argtools import graph_memoized
  from .collect_env import collect_env_info
label_desc: Use image node_id 6 for calling a global function with example usage: get_op_or_tensor_by_name(name) and returns: f, list, G, G