<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_local_version(sigdir, sig):
 """Get the local version of a signature"""

    version = None
    filename = os.path.join(sigdir, '%s.cvd' % sig)
    if os.path.exists(filename):
        cmd = ['sigtool', '-i', filename]
        sigtool = Popen(cmd, stdout=PIPE, stderr=PIPE)
        while True:
            line = sigtool.stdout.readline()
            if line and line.startswith('Version:'):
                version = line.split()[1]
                break
            if not line:
                break
        sigtool.wait()
    return version