code: def chunk_constant_value(node: node_def_pb2.NodeDef, size: int):
      """Extracts and clears the constant value from a NodeDef.
  
      Args:
        node: NodeDef with const value to extract.
        size: Size of NodeDef (for error reporting).
  
      Returns:
        Bytes representation of the Constant tensor content.
      """
      if node.op == _CONST_OP:
          tensor_proto = node.attr["value"].tensor
          if tensor_proto.tensor_content:
              b = tensor_proto.tensor_content
          else:
              # The raw tensor value could be stored in one of the "xxx_val" attributes.
              # Extract it here, and convert to bytes.
              b = tensor_util.MakeNdarray(tensor_proto).tobytes()
  
          # Keep the TensorProto's dtype, tensor_shape, and version_number fields,
          # but clear the raw tensor content / "xxx_val" attributes.
          kept_attributes = {
              key: getattr(tensor_proto, key)
              for key in _KEEP_TENSOR_PROTO_FIELDS
          }
          tensor_proto.Clear()
          for field, val in kept_attributes.items():
              if isinstance(val, message.Message):
                  getattr(tensor_proto, field).MergeFrom(val)
              else:
                  setattr(tensor_proto, field, val)
  
          return b
      else:
          attributes_and_sizes = ", ".join(
              [
                  f"{key}: {util.format_bytes(val.ByteSize())}"
                  for key, val in node.attr.items()
              ]
          )
          raise ValueError(
              "Unable to split GraphDef because at least one of the nodes "
              "individually exceeds the max size of "
              f"{util.format_bytes(constants.max_size())}. "
              "Currently only Const nodes can be further split."
              "\nNode info:"
              f"\n\tsize: {util.format_bytes(size)}"
              f"\n\tname: {node.name}"
              f"\n\top: {node.op}"
              f"\n\tinputs: {node.input}"
              f"\n\top: {node.op}"
              f"\n\tdevice: {node.device}"
              f"\n\tattr (and sizes): {attributes_and_sizes}"
          )
  
imports: from collections.abc import Sequence
  import itertools
  from typing import Optional, Type
  from google.protobuf import message
  from tensorflow.core.framework import graph_pb2
  from tensorflow.core.framework import node_def_pb2
  from tensorflow.python.framework import tensor_util
  from tensorflow.tools.proto_splitter import constants
  from tensorflow.tools.proto_splitter import split
  from tensorflow.tools.proto_splitter import util
label_desc: Use image node_id 1 for calling a global function with example usage: chunk_constant_value(node, size) and returns: b