Please add a docstring to explain the goal of this private helper and the reference management problem it fixes.