code: def _generate_unischema_metadata(dataset, schema):
      """
      Generates the serialized unischema and adds it to the dataset parquet metadata to be used upon reading.
      :param dataset: (ParquetDataset) Dataset to attach schema
      :param schema:  (Unischema) Schema to attach to dataset
      :return: None
      """
      # TODO(robbieg): Simply pickling unischema will break if the UnischemaField class is changed,
      #  or the codec classes are changed. We likely need something more robust.
      assert schema
      serialized_schema = pickle.dumps(schema)
      utils.add_to_dataset_metadata(
          dataset, UNISCHEMA_KEY, serialized_schema
      )
  
imports: import json
  import logging
  import os
  from concurrent import futures
  from contextlib import contextmanager
  from operator import attrgetter
  from urllib.parse import urlparse
  from packaging import version
  from pyarrow import parquet
  from six.moves import cPickle
  from petastorm import utils
  from petastorm.etl.legacy import depickle_legacy_package_name_compatible
  from petastorm.fs_utils import FilesystemResolver, get_filesystem_and_path_or_paths, get_dataset_path
  from petastorm.unischema import Unischema
label_desc: Use image node_id 4 for calling a global function with example usage: _generate_unischema_metadata(dataset, schema) without return types