code: def _get_parent_scope(scope):
      """Removes the final leaf from a scope (`a/b/c/` -> `a/b/`)."""
      parts = scope.split("/")
      return "/".join(parts[:-2] + parts[-1:])
  
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 6 for calling a global function with example usage: _get_parent_scope(scope) and returns: str