code: def add_scope(scope=None, scope_fn=None):
      """Return a decorator which add a TF name/variable scope to a function.
  
      Note that the function returned by the decorator accept an additional 'name'
      parameter, which can overwrite the name scope given when the function is
      created.
  
      Args:
        scope (str): name of the scope. If None, the function name is used.
        scope_fn (fct): Either tf.name_scope or tf.variable_scope
  
      Returns:
        fct: the add_scope decorator
      """
  
      def decorator(f):
          @functools.wraps(f)
          def decorated(*args, **kwargs):
              name = kwargs.pop(
                  "name", None
              )  # Python 2 hack for keyword only args
              with scope_fn(name or scope or f.__name__):
                  return f(*args, **kwargs)
  
          return decorated
  
      return decorator
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import math
  import six
  from six.moves import range
  from six.moves import zip
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers.vq_discrete import DiscreteBottleneck
  import tensorflow.compat.v1
label_desc: Use image node_id 1 for calling a global function with example usage: add_scope(scope, scope_fn) and returns: decorator, decorated, f