Add docstring to _replace_solution_region