def get_version_tuple(string):
    '''Return a version tuple from a string.'''
    match = re.match(r'(\d+)\.(\d+)\.?(\d*)([abc]?)(\d*)', string)
    major = int(match.group(1))
    minor = int(match.group(2))
    patch = int(match.group(3) or 0)
    level = RELEASE_LEVEL_MAP.get(match.group(4), 'final')
    serial = int(match.group(5) or 0)

    return major, minor, patch, level, serial
def get_version_tuple ( string ) : match = re . match ( r'(\d+)\.(\d+)\.?(\d*)([abc]?)(\d*)' , string ) major = int ( match . group ( 1 ) ) minor = int ( match . group ( 2 ) ) patch = int ( match . group ( 3 ) or 0 ) level = RELEASE_LEVEL_MAP . get ( match . group ( 4 ) , 'final' ) serial = int ( match . group ( 5 ) or 0 ) return major , minor , patch , level , serial
Return a version tuple from a string.