code: def _serialize_example(
      example: Any,
      features: features_lib.FeaturesDict,
      serializer: example_serializer.ExampleSerializer,
  ) -> str:
      try:
          encoded_example = features.encode_example(example)
      except Exception as e:  # pylint: disable=broad-except
          py_utils.reraise(
              e,
              prefix="Failed to encode example:\n",
              suffix=f"{example}\n",
          )
  
      return serializer.serialize_example(encoded_example)
  
imports: from __future__ import annotations
  import dataclasses
  import os
  from typing import Any, Dict, List, Optional
  from tensorflow_datasets.core import dataset_info
  from tensorflow_datasets.core import example_serializer
  from tensorflow_datasets.core import features
  from tensorflow_datasets.core import file_adapters
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import splits
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import array_record_module
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: _serialize_example(example, features, serializer) and returns: serializer