<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_log(logfile, exited='Exited with exit code', successful='Successfully completed'):
 """Check a log file to determine status of LSF job Often logfile doesn't exist because the job hasn't begun Parameters logfile : str String with path to logfile exited : str Value to check for in existing logfile for exit with failure successful : str Value to check for in existing logfile for success Returns str, one of 'Pending', 'Running', 'Done', 'Failed' """

    if not os.path.exists(logfile):
        return JobStatus.ready
    if exited in open(logfile).read():
        return JobStatus.failed
    elif successful in open(logfile).read():
        return JobStatus.done
    return JobStatus.running