code: def _update_attributes(json_schema, operator, api_def):
      api_def_attr_map = {}
      for attr in api_def.attr:
          api_def_attr_map[attr.name] = attr
      for attr in operator.attr:
          if "attributes" not in json_schema:
              json_schema["attributes"] = []
          json_attribute = {}
          json_attribute["name"] = attr.name
          attr_type = _convert_attr_type(attr.type)
          if attr_type:
              json_attribute["type"] = attr_type
          else:
              del json_attribute["type"]
          if attr.name in api_def_attr_map:
              api_def_attr = api_def_attr_map[attr.name]
              if api_def_attr.description:
                  json_attribute[
                      "description"
                  ] = api_def_attr.description
          if attr.has_minimum:
              json_attribute["minimum"] = attr.minimum
          if attr.HasField("allowed_values"):
              allowed_values = _convert_attr_value(attr.allowed_values)
              description = (
                  json_attribute["description"] + " "
                  if "description" in json_attribute
                  else ""
              )
              allowed_values = list(
                  map(
                      lambda x: "`" + _format_attribute_value(x) + "`",
                      allowed_values,
                  )
              )
              description = (
                  description
                  + "Must be one of the following: "
                  + ", ".join(allowed_values)
                  + "."
              )
              json_attribute["description"] = description
          if attr.HasField("default_value"):
              default_value = _convert_attr_value(attr.default_value)
              json_attribute["default"] = default_value
          json_schema["attributes"].append(json_attribute)
  
imports: import json
  import logging
  import os
  import google.protobuf
  from tensorflow.core.framework import api_def_pb2
  from tensorflow.core.framework import op_def_pb2
  from tensorflow.core.framework import types_pb2
label_desc: Use image node_id 17 for calling a global function with example usage: _update_attributes(json_schema, operator, api_def) without return types