code: def write_metadata(metadata, path):
      """Write metadata to given path, in JSON format.
  
      Args:
        metadata: A `DatasetMetadata` to write.
        path: a path to a directory where metadata should be written.
      """
      if not file_io.file_exists(path):
          file_io.recursive_create_dir(path)
      schema_file = os.path.join(path, "schema.pbtxt")
      ascii_proto = text_format.MessageToString(metadata.schema)
      file_io.atomic_write_string_to_file(
          schema_file, ascii_proto, overwrite=True
      )
  
file_path: transform/tensorflow_transform/tf_metadata/metadata_io.py
imports: import json
  import os
  import tensorflow
  from tensorflow_transform.tf_metadata import dataset_metadata
  from tensorflow_transform.tf_metadata import schema_utils
  from google.protobuf import text_format
  from tensorflow.python.lib.io import file_io
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 6 for calling a global function with example usage: write_metadata(metadata, path) without return types