def visit_versions(self, func):
for bound in self.bounds:<EOL><INDENT>if bound.lower is not _LowerBound.min:<EOL><INDENT>result = func(bound.lower.version)<EOL>if isinstance(result, Version):<EOL><INDENT>bound.lower.version = result<EOL><DEDENT><DEDENT>if bound.upper is not _UpperBound.inf:<EOL><INDENT>result = func(bound.upper.version)<EOL>if isinstance(result, Version):<EOL><INDENT>bound.upper.version = result<EOL><DEDENT><DEDENT><DEDENT>
Visit each version in the range, and apply a function to each.

        This is for advanced usage only.

        If `func` returns a `Version`, this call will change the versions in
        place.

        It is possible to change versions in a way that is nonsensical - for
        example setting an upper bound to a smaller version than the lower bound.
        Use at your own risk.

        Args:
            func (callable): Takes a `Version` instance arg, and is applied to
                every version in the range. If `func` returns a `Version`, it
                will replace the existing version, updating this `VersionRange`
                instance in place.