code: def _read_entry(
      fin: tf.io.gfile.GFile,
  ) -> Optional[Tuple[str, _Example]]:
      """Read an example from an input file.
  
      Args:
        fin: Input file object for reading dataset entries.
  
      Returns:
        The read exmple and its name, or None in cases of EOF.
  
      Raises:
        Exception: In case entry format is incorect.
      """
      lines = []
      for _ in range(_LINES_PER_ENTRY):
          line = fin.readline().strip()
          lines.append(line)
  
      if all(not line for line in lines):  # EOF?
          return None
  
      # Check structure.
      if (
          lines[0] != "[ID]"
          or lines[2] != "[PRIMARY]"
          or lines[4] != "[EVOLUTIONARY]"
          or lines[26] != "[TERTIARY]"
          or lines[30] != "[MASK]"
          or lines[32]
      ):
          raise ValueError("Incorrect data formatting.")
      lines = lines[:-1]  # Discard last empty (spacer) line.
  
      # The transposes below is required because TFDS allows unknown tensor
      # dimensions only in the first axis.
      key = lines[1]
      example = {
          "id": key,
          "primary": list(lines[3]),
          "evolutionary": _parse_array(lines[5:26]).transpose(),
          "tertiary": _parse_array(lines[27:30]).transpose(),
          "mask": _parse_mask(lines[31]),
          "length": len(lines[3]),
      }
      return key, example
  
file_path: datasets/tensorflow_datasets/datasets/protein_net/protein_net_dataset_builder.py
imports: from __future__ import annotations
  import os
  from typing import Dict, Iterator, List, Optional, Sequence, Tuple, Union
  import urllib
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 3 for calling a global function with example usage: _read_entry(fin) and returns: key,  example, None