code: def _get_single_true_type(dct) -> str:
      """Utility function for getting the single key which has a `True` value in
      a dict. Used to filter a dict of `{field_type: is_valid}` to get
      the field type from a schema or data source."""
      filtered_types = iter([_type for _type in dct if dct[_type]])
      # In the case where there are no keys with a `True` value, return `None`
      return next(filtered_types, None)
  
file_path: ray/python/ray/data/datasource/tfrecords_datasource.py
imports: import struct
  from typing import TYPE_CHECKING, Dict, Iterable, Iterator, List, Optional, Union
  import numpy
  from ray.data.block import Block
  from ray.data.datasource.file_based_datasource import FileBasedDatasource
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 3 for calling a global function with example usage: _get_single_true_type(dct) and returns: next