code: def to_file_format_str(
      file_format: example_gen_pb2.FileFormat,
  ) -> str:  # pylint: disable=invalid-name
      if (
          file_format == example_gen_pb2.FILE_FORMAT_UNSPECIFIED
          or file_format == example_gen_pb2.FORMAT_TFRECORDS_GZIP
      ):
          return "tfrecords_gzip"
      raise ValueError("File format is not valid.")
  
file_path: tfx/tfx/components/example_gen/write_split.py
imports: import os
  from typing import Optional, Any, Dict, Union
  import apache_beam
  import tensorflow
  from tfx.proto import example_gen_pb2
  from tfx.types import standard_component_specs
  from tfx.utils import deprecation_utils
  from tfx_bsl.telemetry import util
label_desc: Use image node_id 2 for calling a global function with example usage: to_file_format_str(file_format) and returns: str