code: def build_info(
      ds_config: DatasetConfig,
      builder: Union[
          tfds.core.DatasetBuilder, tfds.core.DatasetIdentity
      ],
      ds_metadata: Optional[Dict[Any, Any]] = None,
  ) -> tfds.core.DatasetInfo:
      """Returns the dataset metadata."""
      step_metadata = ds_config.step_metadata_info
      if step_metadata is None:
          step_metadata = {}
      episode_metadata = ds_config.episode_metadata_info
      if episode_metadata is None:
          episode_metadata = {}
      step_info = {
          "is_terminal": tf.bool,
          "is_first": tf.bool,
          "is_last": tf.bool,
          **step_metadata,
      }
      if ds_config.observation_info:
          step_info["observation"] = ds_config.observation_info
      if ds_config.action_info:
          step_info["action"] = ds_config.action_info
      if ds_config.reward_info:
          step_info["reward"] = ds_config.reward_info
      if ds_config.discount_info:
          step_info["discount"] = ds_config.discount_info
      if ds_metadata:
          ds_metadata = tfds.core.MetadataDict(ds_metadata)
      return tfds.core.DatasetInfo(
          builder=builder,
          description=ds_config.overall_description,
          features=tfds.features.FeaturesDict(
              {
                  "steps": tfds.features.Dataset(step_info),
                  **episode_metadata,
              }
          ),
          supervised_keys=ds_config.supervised_keys,
          homepage=ds_config.homepage,
          citation=ds_config.citation,
          metadata=ds_metadata,
      )
  
file_path: datasets/tensorflow_datasets/rlds/rlds_base.py
imports: from __future__ import annotations
  import dataclasses
  import os
  from typing import Any, Dict, Generator, List, Optional, Tuple, Union
  from absl import logging
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
  from tensorflow_datasets.rlds import envlogger_reader
label_desc: Use image node_id 1 for calling a global function with example usage: build_info(ds_config, builder, ds_metadata) and returns: tfds