In `_real_to_rational`, as the for loop executes, a `dictionary` called `reps` is built. Please refer:
https://github.com/sympy/sympy/blob/master/sympy/simplify/simplify.py#L3115

`reps` contains key, value pairs such that:
`key == the value of r` that the for loop generates. And,
`value == the reduced expression` that is a `Rational`

This `dict` and `expr` is further passed on to `p.subs`. That finds all keys in `reps` that are also present in `expr` and substitutes the value corresponding to that key in `expr`.

Now, since we are changing `r` itself, but doing no changes to `expr`, `p.subs` will not be able to substitute in `expr` the reduced value of the `r` that got changed because the key corresponding to it won't be present in `expr`.
So, we are declaring a new var, `oldr`, that stores the original value of `r` prior to its modification that goes in the `reps` dictionary.

As for the `try except` clause, that is for the case when `tolerance==None`. Then, `round_to` will not be declared and hence the `try except` clause is for the case where `round_to`  isn't declared.

Should there be a need of further clarification, kindly let me know.