code: def _root(path, root):
      '''
      Relocate an absolute path to a new root directory.
      '''
      if root:
          return os.path.join(root, os.path.relpath(path, os.path.sep))
      else:
          return patf _root(path, root):
      '''
      Relocate an absolute path to a new root directory.
      '''
      if root:
          return os.path.join(root, os.path.relpath(path, os.path.sep))
      else:
          return path
docs: Relocate an absolute path to a new root directory.