def _sanitize_position(self, pos, tree=None):
        """
        Ensure a position tuple until the result does not
        point to a :class:`Tree` any more.
        """
        if pos is not None:
            tree = tree or self._tree
            entry = self._lookup_entry(tree, pos)
            if isinstance(entry, Tree):
                pos = pos + self._sanitize_position((entry.root,), tree=entry)
        return pos