code: def _format_record(array, sparse):
      if sparse:
          return {
              "values": array,
              "indices": [[i] for i in range(len(array))],
              "dense_shape": (len(array),),
          }
      return array
  
imports: import random
  from absl.testing import parameterized
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import context
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 3 for calling a global function with example usage: _format_record(array, sparse) and returns: array, dict