Return the number of the final inversion result.

def read_lastmodfile(directory):
    """
    Return the number of the final inversion result.
    """
    filename = '{0}/exe/inv.lastmod'.format(directory)
    # filename HAS to exist. Otherwise the inversion was not finished
    if(not os.path.isfile(filename)):
        return None

    linestring = open(filename, 'r').readline().strip()
    linestring = linestring.replace("\n", '')
    linestring = linestring.replace(".mag", '')
    linestring = linestring.replace("../inv/rho", '')
    return linestring