code: def final_energy_from_outcar( filename='OUTCAR' ):
      
      with open( filename ) as f:
          outcar = f.read()
      energy_re = re.compile( "energy\(sigma->0\) =\s+([-\d\.]+)" )
      energy = float( energy_re.findall( outcar )[-1] )
      return energy
docs: Finds and returns the energy from a VASP OUTCAR file, by searching for the last `energy(sigma->0)` entry.
  
      Args:
          filename (Str, optional): OUTCAR filename. Defaults to 'OUTCAR'.
  
      Returns:
          (Float): The last energy read from the OUTCAR file.