<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():
 """Obtain InaSAFE's version from version file. :returns: The current version number. :rtype: str """

    # Get location of application wide version info
    root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__)))
    version_file = os.path.join(root_dir, 'safe', 'definitions', 'versions.py')
    fid = open(version_file)
    version = ''
    for line in fid.readlines():
        if line.startswith('inasafe_version'):
            version = line.strip().split(' = ')[1]
            version = version.replace('\'', '')
            break
    fid.close()
    if version:
        return version
    else:
        raise Exception('Version is not found in %s' % version_file)