code: def supervised_to_dict(dataset, text2self):
      """Turns a supervised dataset into a dataset with a feature dictionary.
  
      if text2self, then the features dictionary contains a "targets" key.
      else, the features dictionary contains "inputs" and "targets" keys.
  
      Args:
        dataset: a tf.data.Dataset
        text2self: a boolean
      Returns:
        a tf.data.Dataset
      """
  
      def my_fn(inputs, targets):
          if text2self:
              return {"targets": targets}
          else:
              return {"inputs": inputs, "targets": targets}
  
      return dataset.map(
          my_fn, num_parallel_calls=tf.data.experimental.AUTOTUNE
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import os
  import gin
  import tensorflow.compat.v1
  import tensorflow_datasets
label_desc: Use image node_id 10 for calling a global function with example usage: supervised_to_dict(dataset, text2) and returns: dataset, dict, dict