code: def serialize_dataset_to_graph(dataset):
      dataset = (
          dataset._apply_debug_options()
      )  # pylint: disable=protected-access
      graph_def = gen_dataset_ops.dataset_to_graph_v2(
          dataset._variant_tensor,  # pylint: disable=protected-access
          external_state_policy=ExternalStatePolicy.WARN.value,
          strip_device_assignment=True,
      )
      return graph_def
  
imports: import threading
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops.options import ExternalStatePolicy
  from tensorflow.python.distribute import input_lib
  from tensorflow.python.distribute.coordinator import remote_value
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import function
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import type_spec
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_dataset_ops
  from tensorflow.python.ops import gen_experimental_dataset_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.util import nest
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 1 for calling a global function with example usage: serialize_dataset_to_graph(dataset) and returns: graph_def