code: def _serialize_op_attr(op_attr):
      """Deterministicly serializes tf.Operation attrs since it is a map."""
      sorted_attributes = sorted(op_attr.items(), key=lambda kv: kv[0])
      if "f" in op_attr:
          # This is a tf.Function node, and it includes attributes that are
          # inconsistent across runs such as _gradient_op_type, config_proto, so we
          # only keep input and output types since other information will arrive from
          # the FuncGraph attributes.
          sorted_attributes = [
              kv for kv in sorted_attributes if kv[0] in ("Tin", "Tout")
          ]
      result = []
      for key, attr_value in sorted_attributes:
          result.append(key)
          attr_value = copy.deepcopy(attr_value)
          if attr_value.list.func:
              raise ValueError(
                  "Unable to serialize op attributes that contain a `list.func` field"
              )
          if attr_value.HasField("func"):
              # There should be a separate call for the FuncGraph attributes.
              attr_value.ClearField("func")
          result.append(attr_value.SerializeToString())
      return result
  
imports: import collections
  import copy
  import hashlib
  import itertools
  from typing import Iterable, List, Mapping, Optional, Set, Union
  import uuid
  from absl import logging
  import tensorflow
  from tensorflow_transform import analyzer_nodes
  from tensorflow_transform import common_types
  from tensorflow_transform import nodes
  from tensorflow_transform import tf_utils
  from tfx_bsl.types import tfx_namedtuple
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import function_def_to_graph
  from tensorflow.python.util import object_identity
label_desc: Use image node_id 7 for calling a global function with example usage: _serialize_op_attr(op_attr) and returns: result