<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clean_jobs(self, link, job_dict=None, clean_all=False):
 """ Clean up all the jobs associated with this link. Returns a `JobStatus` enum """

        failed = False
        if job_dict is None:
            job_dict = link.jobs

        for job_details in job_dict.values():
            # clean failed jobs
            if job_details.status == JobStatus.failed or clean_all:
                # clean_job(job_details.logfile, job_details.outfiles, self._dry_run)
                clean_job(job_details.logfile, {}, self._dry_run)
                job_details.status = JobStatus.ready
        if failed:
            return JobStatus.failed
        return JobStatus.done