code: def get_key(record):
      if almost_equal_schemas(record, IdList):
          key = "values"
      elif almost_equal_schemas(
          record, IdScoreList, check_field_types=False
      ):
          key = "values:keys"
      else:
          raise NotImplementedError(
              "Not implemented for {}".format(record)
          )
      assert (
          record[key].metadata is not None
      ), "Blob {} doesn't have metadata".format(str(record[key]()))
      return record[key]
  
imports: import logging
  from collections import namedtuple
  import numpy
  from caffe2.proto import caffe2_pb2
  from caffe2.python import core, schema, scope, utils, workspace
  from caffe2.python.layers.tags import TagContext
label_desc: Use image node_id 2 for calling a global function with example usage: get_key(record) and returns: record