def reroot(root: expression.Expression, source_path: path.Path) -> expression.Expression:
    'Reroot to a new path, maintaining a input proto index.\n\n  Similar to root.get_descendant_or_error(source_path): however, this\n  method retains the ability to get a map to the original index.\n\n  Args:\n    root: the original root.\n    source_path: the path to the new root.\n\n  Returns:\n    the new root.\n  '
    new_root = root
    for step in source_path.field_list:
        new_root = _RerootExpression(new_root, step)
    return new_root
Reroot to a new path, maintaining a input proto index.

Similar to root.get_descendant_or_error(source_path): however, this
method retains the ability to get a map to the original index.

Args:
  root: the original root.
  source_path: the path to the new root.

Returns:
  the new root.
def reroot(root: expression.Expression, source_path: path.Path) -> expression.Expression:
    'Reroot to a new path, maintaining a input proto index.\n\n  Similar to root.get_descendant_or_error(source_path): however, this\n  method retains the ability to get a map to the original index.\n\n  Args:\n    root: the original root.\n    source_path: the path to the new root.\n\n  Returns:\n    the new root.\n  '
    new_root = root
    for step in source_path.field_list:
        new_root = _RerootExpression(new_root, step)
    return new_root