def version_string(version_info):
    """
    Return the 5-tuple version_info as a version string, as follows:

        "1.2.3"  # if version_info[3] == 'final'
        "1.2.3.alpha.42"  # if version_info[3] != 'final'
    """
    major, minor, micro, releaselevel, serial = version_info
    version_str = '{}.{}.{}'.format(major, minor, micro)
    if releaselevel != 'final':
        version_str = '{}.{}.{}'.format(version_str, releaselevel, serial)
    return version_str