code: def read_lastmodfile(directory):
      
      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
docs: Return the number of the final inversion result.