class_docstr: Util class to build splits.
  
  Usage is as follow:
  
  ```py
  split_builder = SplitBuilder(...)
  
  with split_builder.maybe_beam_pipeline():
    split_info_future = split_builder.submit_split_generation(...)
  
  split_info = split_info_future.result()
  ```
  
  * submit_split_generation:
    * For generator based split: Generate the split
    * For Apache Beam based split: Create the `beam.PCollection` and returns
      a future.
  * `split_info_future.result()`: Called after all `beam.PCollection`s have
    finished. Finalize the `split_info` by collecting all pipeline results.
  
  `submit_split_generation` / `.result` should be called once per
  split.
class_docstr_tok: ["Util","class","to","build","splits",".","Usage","is","as","follow",":","``","`","py","split_builder","=","SplitBuilder","(","...",")","with","split_builder.maybe_beam_pipeline","(",")",":","split_info_future","=","split_builder.submit_split_generation","(","...",")","split_info","=","split_info_future.result","(",")","``","`","*","submit_split_generation",":","*","For","generator","based","split",":","Generate","the","split","*","For","Apache","Beam","based","split",":","Create","the","`","beam.PCollection","`","and","returns","a","future",".","*","`","split_info_future.result","(",")","`",":","Called","after","all","`","beam.PCollection","`","s","have","finished",".","Finalize","the","`","split_info","`","by","collecting","all","pipeline","results",".","`","submit_split_generation","`","\/","`",".result","`","should","be","called","once","per","split","."]
docstr: Normalize legacy split API into new dict[split_name, generator].
  
  This function convert the legacy `List[tfds.core.SplitGenerator]` into
  the new `{'split_name': generator}` structure.
  
  Could be removed if all datasets were updated.
  
  Args:
    split_generators: Either legacy or new split_generators
    generator_fn: The `GeneratorBasedBuilder._generate_examples` function.
    is_beam: `True` if using legacy `tfds.core.BeamBasedBuilder`
  
  Returns:
    split_generators: New split generator structure.
docstr_tok: ["Normalize","legacy","split","API","into","new","dict","[","split_name",",","generator","]",".","This","function","convert","the","legacy","`","List","[","tfds.core.SplitGenerator","]","`","into","the","new","`","{","'split_name","'",":","generator","}","`","structure",".","Could","be","removed","if","all","datasets","were","updated",".","Args",":","split_generators",":","Either","legacy","or","new","split_generators","generator_fn",":","The","`","GeneratorBasedBuilder._generate_examples","`","function",".","is_beam",":","`","True","`","if","using","legacy","`","tfds.core.BeamBasedBuilder","`","Returns",":","split_generators",":","New","split","generator","structure","."]
code: def normalize_legacy_split_generators(
      self,
      split_generators: Union[
          Dict[str, SplitGenerator], List[SplitGeneratorLegacy]
      ],
      generator_fn: Callable[..., Any],
      is_beam: bool,
  ) -> Dict[str, SplitGenerator]:
      """Normalize legacy split API into new dict[split_name, generator].
  
      This function convert the legacy `List[tfds.core.SplitGenerator]` into
      the new `{'split_name': generator}` structure.
  
      Could be removed if all datasets were updated.
  
      Args:
        split_generators: Either legacy or new split_generators
        generator_fn: The `GeneratorBasedBuilder._generate_examples` function.
        is_beam: `True` if using legacy `tfds.core.BeamBasedBuilder`
  
      Returns:
        split_generators: New split generator structure.
      """
      if isinstance(split_generators, dict):  # New structure
          return split_generators
      if isinstance(split_generators, list):  # Legacy structure
          if is_beam:  # Legacy `tfds.core.BeamBasedBuilder`
              generator_fn = beam.ptransform_fn(generator_fn)
              return {
                  s.name: generator_fn(
                      **s.gen_kwargs
                  )  # Create the `beam.PTransform`
                  for s in split_generators
              }
          else:
              return {
                  split_generator.name: generator_fn(
                      **split_generator.gen_kwargs
                  )
                  for split_generator in split_generators
              }
      else:
          raise TypeError(
              f"Invalid `_split_generators` returned value: {split_generators}"
          )
  
imports: import collections.abc
  import contextlib
  import dataclasses
  import functools
  import itertools
  import sys
  from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Union
  from absl import logging
  import click
  import psutil
  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 import utils
  from tensorflow_datasets.core import writer
  from tensorflow_datasets.core.utils import shard_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import apache_beam
label_desc: Use image node_id 4 for calling the SplitBuilder obj's underlying member method code with example usage: obj.normalize_legacy_split_generators(split_generators, generator_fn, is_beam) and returns: split_generators, unknown, unknown