<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_version_string(version):
 """Translate a version tuple into a string. Specify the __version__ as a tuple for more precise comparisons, and translate it to __version_string__ for when that's needed. This function exists primarily for easier unit testing. Args: version (Tuple[int, int, int, str]):
 three ints and an optional string. Returns: version_string (str):
 the tuple translated into a string per semver.org """

    version_len = len(version)
    if version_len == 3:
        version_string = '%d.%d.%d' % version
    elif version_len == 4:
        version_string = '%d.%d.%d-%s' % version
    else:
        raise Exception(
            'Version tuple is non-semver-compliant {} length!'.format(version_len)
        )
    return version_string