def check_mdrun_success(logfile):
if not os.path.exists(logfile):<EOL><INDENT>return None<EOL><DEDENT>with open(logfile, '<STR_LIT:rb>') as log:<EOL><INDENT>log.seek(-<NUM_LIT>, <NUM_LIT:2>)<EOL>for line in log:<EOL><INDENT>line = line.decode('<STR_LIT>')<EOL>if line.startswith("<STR_LIT>"):<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT>return False<EOL>
Check if ``mdrun`` finished successfully.

    Analyses the output from ``mdrun`` in *logfile*. Right now we are
    simply looking for the line "Finished mdrun on node" in the last 1kb of
    the file. (The file must be seeakable.)

    :Arguments:
      *logfile* : filename
         Logfile produced by ``mdrun``.

    :Returns: ``True`` if all ok, ``False`` if not finished, and
              ``None`` if the *logfile* cannot be opened