code: def get_graph_element_name(elem):
      """Obtain the name or string representation of a graph element.
  
      If the graph element has the attribute "name", return name. Otherwise, return
      a __str__ representation of the graph element. Certain graph elements, such as
      `SparseTensor`s, do not have the attribute "name".
  
      Args:
        elem: The graph element in question.
  
      Returns:
        If the attribute 'name' is available, return the name. Otherwise, return
        str(fetch).
      """
  
      return elem.name if hasattr(elem, "name") else str(elem)
  
imports: import collections
  import json
label_desc: Use image node_id 1 for calling a global function with example usage: get_graph_element_name(elem) and returns: unknown