code: def write_block_to_file(
      self, block: BlockAccessor, file: "pyarrow.NativeFile"
  ):
      arrow_table = block.to_arrow()
  
      # It seems like TFRecords are typically row-based,
      # https://www.tensorflow.org/tutorials/load_data/tfrecord#writing_a_tfrecord_file_2
      # so we must iterate through the rows of the block,
      # serialize to tf.train.Example proto, and write to file.
  
      examples = _convert_arrow_table_to_examples(
          arrow_table, self.tf_schema
      )
  
      # Write each example to the arrow file in the TFRecord format.
      for example in examples:
          _write_record(file, example)
  
file_path: ray/python/ray/data/datasource/tfrecords_datasink.py
imports: from typing import TYPE_CHECKING, Optional
  from ray.data._internal.util import _check_import
  from ray.data.block import BlockAccessor
  from ray.data.datasource.file_datasink import BlockBasedFileDatasink
  from ray.data.datasource.tfrecords_datasource import _convert_arrow_table_to_examples, _write_record
label_desc: Use image node_id 2 for calling the _TFRecordDatasink obj's underlying member method code with example usage: obj.write_block_to_file(block, file) without return types