@classmethod
def _cmp_version_part(cls, version1, version2):
    """Compares two versions."""
    ver1_it = iter(version1)
    ver2_it = iter(version2)
    while True:
        v1 = next(ver1_it, None)
        v2 = next(ver2_it, None)
        if v1 is None or v2 is None:
            if v1 is not None:
                return 1
            if v2 is not None:
                return -1
            return 0
        if v1.isdigit() and v2.isdigit():
            a = int(v1)
            b = int(v2)
            if a < b:
                return -1
            if a > b:
                return 1
        else:
            r = cls._cmp_version_string(v1, v2)
            if r != 0:
                return r
