code: def maybe_global_mode(mode):
      """Returns :func:`texar.tf.global_mode` if :attr:`mode` is `None`,
      otherwise returns :attr:`mode` as-is.
      """
      if mode is None:
          return context.global_mode()
      else:
          return mode
  
file_path: texar/texar/tf/utils/mode.py
imports: import tensorflow
  from texar.tf import context
label_desc: Use image node_id 1 for calling a global function with example usage: maybe_global_mode(mode) and returns: context, mode