<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def checkversion(version):
 """Checks foliadocserve version, returns 1 if the document is newer than the library, -1 if it is older, 0 if it is equal"""

    try:
        for refversion, responseversion in zip([int(x) for x in REQUIREFOLIADOCSERVE.split('.')], [int(x) for x in version.split('.')]):
            if responseversion > refversion:
                return 1 #response is newer than library
            elif responseversion < refversion:
                return -1 #response is older than library
        return 0 #versions are equal
    except ValueError:
        raise ValueError("Unable to parse version, invalid syntax")