code: def rename_root_module(module: str, root: str, new_root: str) -> str:
      """
      Rename a module to a new root.
  
      Parameters
      ----------
      module
          Module to rename
      root
          Original root
      new_root
          New root
  
      Returns
      -------
      New module name (if it matches root) otherwise original name.
      """
      if module.startswith(root):
          return new_root + module[len(root) :]
      else:
          return module
  
imports: from __future__ import annotations
  import contextlib
  import functools
  import importlib
  import importlib.abc
  import importlib.machinery
  import os
  import pathlib
  import sys
  import threading
  import warnings
  from abc import abstractmethod
  from importlib._bootstrap import _ImportLockContext
  from types import ModuleType
  from typing import Any, ContextManager, Dict, List, NamedTuple
  from typing_extensions import Self
  from .fast_slow_proxy import _FunctionProxy, _is_function_or_method, _Unusable, get_final_type_map, get_intermediate_type_map, get_registered_functions
label_desc: Use image node_id 1 for calling a global function with example usage: rename_root_module(module, root, new_root) and returns: unknown, module