def select_version(self, version_range):
row = -<NUM_LIT:1><EOL>version = None<EOL>for i, package in self.packages.iteritems():<EOL><INDENT>if package.version in version_rangeand (version is None or version < package.version):<EOL><INDENT>version = package.version<EOL>row = i<EOL><DEDENT><DEDENT>self.clearSelection()<EOL>if row != -<NUM_LIT:1>:<EOL><INDENT>self.selectRow(row)<EOL><DEDENT>return version<EOL>
Select the latest versioned package in the given range.

        If there are no packages in the range, the selection is cleared.