code: def encode_resource_handle(resource_handle):
      """Encode a ResourceHandle proto as custom numpy struct type."""
      return np.asarray(
          bytearray(resource_handle.SerializeToString()),
          dtype=dtypes.np_resource,
      )
  
imports: import numpy
  from tensorflow.core.framework import resource_handle_pb2
  from tensorflow.python.client import pywrap_tf_session
  from tensorflow.python.framework import device
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_data_flow_ops
  from tensorflow.python.util import compat
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 1 for calling a global function with example usage: encode_resource_handle(resource_handle) and returns: np