code: def maybe_with_graph(graph=None, create_if_none=True):
      """Eager-compatible Graph().as_default() yielding the graph."""
      if tf.executing_eagerly():
          yield None
      else:
          if graph is None and create_if_none:
              graph = tf.Graph()
  
          if graph is None:
              yield None
          else:
              with graph.as_default():
                  yield graph
  
imports: from __future__ import annotations
  import collections
  import contextlib
  from typing import Any, Union
  import numpy
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils import tree_utils
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 9 for calling a global function with example usage: maybe_with_graph(graph, create_if_none) without return types