def _get_sortkey(self):
        """
        Return a value which can be used to compare two versions.
        Sort order:
        1. epoch
        2. release version
        3. postrelease > release > prerelease
        4. postrelease#
        5. non-dev > dev
        6. dev#

        :return: a value which can be used for comparing this version to another version
        :rtype: tuple
        """
        rpriority = self.RELEASE_TYPE_PRIORITIES.get(self.rtype, 0)
        return (
            self.epoch,
            self.versiontuple,
            rpriority,
            self.subversion,
            self.is_postrelease,
            self.postrelease,
            not self.is_devrelease,
            self.devrelease
        )

        Return a value which can be used to compare two versions.
        Sort order:
        1. epoch
        2. release version
        3. postrelease > release > prerelease
        4. postrelease#
        5. non-dev > dev
        6. dev#

        :return: a value which can be used for comparing this version to another version
        :rtype: tuple
        
lib/libversion.py