code: def _read_file(filename):
      """Reads a file containing `GraphDef` and returns the protocol buffer.
  
      Args:
        filename: `graph_def` filename including the path.
  
      Returns:
        A `GraphDef` protocol buffer.
  
      Raises:
        IOError: If the file doesn't exist, or cannot be successfully parsed.
      """
      graph_def = graph_pb2.GraphDef()
      if not file_io.file_exists(filename):
          raise IOError(f"File {filename} does not exist.")
      # First try to read it as a binary file.
      with file_io.FileIO(filename, "rb") as f:
          file_content = f.read()
      try:
          graph_def.ParseFromString(file_content)
          return graph_def
      except Exception:  # pylint: disable=broad-except
          pass
  
      # Next try to read it as a text file.
      try:
          text_format.Merge(file_content, graph_def)
      except text_format.ParseError as e:
          raise IOError(f"Cannot parse file {filename}: {str(e)}.")
  
      return graph_def
  
imports: import copy
  from packaging import version
  import os.path
  import re
  import sys
  from google.protobuf.any_pb2 import Any
  from google.protobuf import text_format
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.core.framework import graph_pb2
  from tensorflow.core.framework import op_def_pb2
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.core.protobuf import saver_pb2
  from tensorflow.python.client import pywrap_tf_session
  from tensorflow.python.eager import context
  from tensorflow.python.framework import byte_swap_tensor
  from tensorflow.python.framework import error_interpolation
  from tensorflow.python.framework import graph_io
  from tensorflow.python.framework import importer
  from tensorflow.python.framework import op_def_registry
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import versions
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import compat
label_desc: Use image node_id 2 for calling a global function with example usage: _read_file(filename) and returns: graph_def, graph_def