code: def to_file(dataset, filename):
      """to_file"""
      resource = core_ops.io_file_init(filename)
  
      dataset = dataset.map(lambda e: (e, tf.constant(False)))
      dataset = dataset.concatenate(
          tf.data.Dataset.from_tensor_slices(
              [tf.constant([], tf.string)]
          ).map(lambda e: (e, tf.constant(True)))
      )
      dataset = dataset.map(
          lambda entry, final: core_ops.io_file_call(
              entry, final, resource
          )
      )
      dataset = dataset.map(tf.shape)
  
      return dataset.reduce(0, lambda x, y: x + y)
  
label_desc: Use image node_id 1 for calling a global function with example usage: to_file(dataset, filename) and returns: dataset