code: def _instance_scope_name(instance_name, constructor_name_scope):
      """Specifies a name scope for methods of a distribution (etc.) instance."""
      global _IN_INSTANCE_SCOPE
      current_parent_scope = _get_parent_scope(
          _name_scope_dry_run(instance_name)
      )
      constructor_parent_scope = _get_parent_scope(
          constructor_name_scope
      )
      if current_parent_scope == constructor_parent_scope:
          # Reuse initial scope.
          return constructor_name_scope
  
      if _IN_INSTANCE_SCOPE:
          # Elide the constructor scope annotation when we're inside a method of a
          # higher-level distribution (which should itself have annotated its
          # constructor scope).
          constructor_scope_annotation = ""
      else:
          # Otherwise, include a reference to the sanitized constructor scope.
          constructor_scope_annotation = "_CONSTRUCTED_AT_" + (
              strip_invalid_chars(constructor_parent_scope[:-1])
              if constructor_parent_scope[:-1]
              else "top_level"
          )
      return (
          current_parent_scope
          + instance_name
          + constructor_scope_annotation
          + "/"
      )
  
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 5 for calling a global function with example usage: _instance_scope_name(instance_name, constructor_name_scope) and returns: unknown, constructor_name_scope