code: def encode_spec_to_file(output_path, tensor_data_spec):
      """Save a tensor data spec to a tfrecord file.
  
      Args:
        output_path: The path to the TFRecord file which will contain the spec.
        tensor_data_spec: Nested list/tuple or dict of TensorSpecs, describing the
          shape of the non-batched Tensors.
      """
      spec_proto = tensor_spec.to_proto(tensor_data_spec)
      with tf.io.TFRecordWriter(output_path) as writer:
          writer.write(spec_proto.SerializeToString())
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl import logging
  import tensorflow
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import trajectory
  from tf_agents.utils import eager_utils
  from tf_agents.utils import example_encoding
  from tf_agents.utils import nest_utils
  from tensorflow.core.protobuf import struct_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: encode_spec_to_file(output_path, tensor_data_spec) without return types