code: def make_tfxio(
      file_pattern: OneOrMorePatterns,
      telemetry_descriptors: List[str],
      payload_format: int,
      data_view_uri: Optional[str] = None,
      schema: Optional[schema_pb2.Schema] = None,
      read_as_raw_records: bool = False,
      raw_record_column_name: Optional[str] = None,
      file_format: Optional[
          Union[int, List[int], str, List[str]]
      ] = None,
  ) -> tfxio.TFXIO:
      """Creates a TFXIO instance that reads `file_pattern`.
  
      Args:
        file_pattern: the file pattern for the TFXIO to access.
        telemetry_descriptors: A set of descriptors that identify the component that
          is instantiating the TFXIO. These will be used to construct the namespace
          to contain metrics for profiling and are therefore expected to be
          identifiers of the component itself and not individual instances of source
          use.
        payload_format: one of the enums from example_gen_pb2.PayloadFormat (may be
          in string or int form). If None, default to FORMAT_TF_EXAMPLE.
        data_view_uri: uri to a DataView artifact. A DataView is needed in order to
          create a TFXIO for certain payload formats.
        schema: TFMD schema. Note: although optional, some payload formats need a
          schema in order for all TFXIO interfaces (e.g. TensorAdapter()) to work.
          Unless you know what you are doing, always supply a schema.
        read_as_raw_records: If True, ignore the payload type of `examples`. Always
          use RawTfRecord TFXIO.
        raw_record_column_name: If provided, the arrow RecordBatch produced by the
          TFXIO will contain a string column of the given name, and the contents of
          that column will be the raw records. Note that not all TFXIO supports this
          option, and an error will be raised in that case. Required if
          read_as_raw_records == True.
        file_format: file format for each file_pattern. Only 'tfrecords_gzip' and
          'parquet' are supported for now.
  
      Returns:
        a TFXIO instance.
      """
      if not isinstance(payload_format, int):
          payload_format = example_gen_pb2.PayloadFormat.Value(
              payload_format
          )
  
      if file_format is not None:
          if type(file_format) is not type(file_pattern):
              raise ValueError(
                  f"The type of file_pattern and file_formats should be the same."
                  f"Given: file_pattern={file_pattern}, file_format={file_format}"
              )
          if isinstance(file_format, list):
              if len(file_format) != len(file_pattern):
                  raise ValueError(
                      f"The length of file_pattern and file_formats should be the same."
                      f"Given: file_pattern={file_pattern}, file_format={file_format}"
                  )
              else:
                  file_format = [
                      _file_format_from_string(item)
                      for item in file_format
                  ]
                  if any(
                      item not in _SUPPORTED_FILE_FORMATS
                      for item in file_format
                  ):
                      raise NotImplementedError(
                          f"{file_format} is not supported yet."
                      )
          else:  # file_format is str type.
              file_format = _file_format_from_string(file_format)
              if file_format not in _SUPPORTED_FILE_FORMATS:
                  raise NotImplementedError(
                      f"{file_format} is not supported yet."
                  )
  
      if read_as_raw_records:
          assert raw_record_column_name is not None, (
              "read_as_raw_records is specified - "
              "must provide raw_record_column_name"
          )
          return raw_tf_record.RawTfRecordTFXIO(
              file_pattern=file_pattern,
              raw_record_column_name=raw_record_column_name,
              telemetry_descriptors=telemetry_descriptors,
          )
  
      if (
          payload_format
          == example_gen_pb2.PayloadFormat.FORMAT_TF_EXAMPLE
      ):
          return tf_example_record.TFExampleRecord(
              file_pattern=file_pattern,
              schema=schema,
              raw_record_column_name=raw_record_column_name,
              telemetry_descriptors=telemetry_descriptors,
          )
  
      if (
          payload_format
          == example_gen_pb2.PayloadFormat.FORMAT_TF_SEQUENCE_EXAMPLE
      ):
          return tf_sequence_example_record.TFSequenceExampleRecord(
              file_pattern=file_pattern,
              schema=schema,
              raw_record_column_name=raw_record_column_name,
              telemetry_descriptors=telemetry_descriptors,
          )
  
      if payload_format == example_gen_pb2.PayloadFormat.FORMAT_PROTO:
          assert (
              data_view_uri is not None
          ), "Accessing FORMAT_PROTO requires a DataView to parse the proto."
          return record_to_tensor_tfxio.TFRecordToTensorTFXIO(
              file_pattern=file_pattern,
              saved_decoder_path=data_view_uri,
              telemetry_descriptors=telemetry_descriptors,
              raw_record_column_name=raw_record_column_name,
          )
  
      if payload_format == example_gen_pb2.PayloadFormat.FORMAT_PARQUET:
          return parquet_tfxio.ParquetTFXIO(
              file_pattern=file_pattern,
              schema=schema,
              telemetry_descriptors=telemetry_descriptors,
          )
  
      raise NotImplementedError(
          "Unsupport payload format: {}".format(payload_format)
      )
  
imports: import logging
  from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
  import pyarrow
  import tensorflow
  from tfx.components.experimental.data_view import constants
  from tfx.components.util import examples_utils
  from tfx.proto import example_gen_pb2
  from tfx.types import artifact
  from tfx.types import standard_artifacts
  from tfx_bsl.tfxio import dataset_options
  from tfx_bsl.tfxio import parquet_tfxio
  from tfx_bsl.tfxio import raw_tf_record
  from tfx_bsl.tfxio import record_to_tensor_tfxio
  from tfx_bsl.tfxio import tf_example_record
  from tfx_bsl.tfxio import tf_sequence_example_record
  from tfx_bsl.tfxio import tfxio
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 9 for calling a global function with example usage: make_tfxio(file_pattern, telemetry_descriptors, payload_format, data_view_uri, schema, read_as_raw_records, raw_record_column_name, file_format) and returns: raw_tf_record, tf_example_record, tf_sequence_example_record, record_to_tensor_tfxio, parquet_tfxio