def sort_versions(self):
if self.sorted:<EOL><INDENT>return<EOL><DEDENT>for orderer in (self.solver.package_orderers or []):<EOL><INDENT>entries = orderer.reorder(self.entries, key=lambda x: x.package)<EOL>if entries is not None:<EOL><INDENT>self.entries = entries<EOL>self.sorted = True<EOL>if self.pr:<EOL><INDENT>self.pr("<STR_LIT>", self.package_name, repr(orderer))<EOL><DEDENT>return<EOL><DEDENT><DEDENT>self.entries = sorted(self.entries, key=lambda x: x.version, reverse=True)<EOL>self.sorted = True<EOL>if self.pr:<EOL><INDENT>self.pr("<STR_LIT>", self.package_name)<EOL><DEDENT>
Sort entries by version.

        The order is typically descending, but package order functions can
        change this.