code: def instance_scope(instance_name, constructor_name_scope):
      """Constructs a name scope for methods of a distribution (etc.) instance."""
      global _IN_INSTANCE_SCOPE
      with tf.name_scope(
          _instance_scope_name(instance_name, constructor_name_scope)
      ) as name_scope:
          was_in_instance_scope = _IN_INSTANCE_SCOPE
          _IN_INSTANCE_SCOPE = True
          try:
              yield name_scope
          finally:
              _IN_INSTANCE_SCOPE = was_in_instance_scope
  
file_path: probability/tensorflow_probability/python/internal/name_util.py
imports: import contextlib
  import re
  import tensorflow.compat.v1
  import tensorflow.compat.v2
label_desc: Use image node_id 4 for calling a global function with example usage: instance_scope(instance_name, constructor_name_scope) without return types