code: def _common_caffe2_arg_to_onnx_attr(cls, op_def, arg):
      # name
      op_type = op_def.type
      name = cls._global_renamed_args.get(arg.name, arg.name)
      if op_type in cls._per_op_renamed_args:
          # Per-op attribute renames override the global attribute renames
          name = cls._per_op_renamed_args[op_type].get(arg.name, name)
  
      # value
      if arg.HasField("f"):
          value = arg.f
      elif arg.HasField("i"):
          value = arg.i
      elif arg.HasField("s"):
          value = arg.s
      elif arg.floats:
          value = arg.floats
      elif arg.ints:
          value = arg.ints
      elif arg.strings:
          value = arg.strings
      else:
          raise ValueError(
              "Could not find data field in arg: {}".format(arg)
          )
  
      if name in cls._blocklist_caffe2_args:
          assert value in cls._blocklist_caffe2_args[arg.name]
          return None
  
      return helper.make_attribute(name, value)
  
imports: import collections
  import itertools
  import logging
  import re
  from caffe2.python import core
  from onnx import checker, helper, numpy_helper, mapping, GraphProto, NodeProto, TensorProto, OperatorSetIdProto
  from onnx.helper import make_tensor_value_info, make_model
  import numpy
  from caffe2.python.onnx.helper import c2_native_run_net
  import caffe2.python._import_c_extension
label_desc: Use image node_id 2 for calling the Caffe2Frontend obj's underlying member method code with example usage: obj._common_caffe2_arg_to_onnx_attr(cls, op_def, arg) and returns: helper, None