<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rerun(client, run, job):
 """Re-run existing workflow or tool using CWL runner."""

    from renku.models.provenance import ProcessRun
    activity = client.process_commmit()

    if not isinstance(activity, ProcessRun):
        click.secho('No tool was found.', fg='red', file=sys.stderr)
        return

    try:
        args = ['cwl-runner', activity.path]
        if job:
            job_file = tempfile.NamedTemporaryFile(
                suffix='.yml', dir=os.getcwd(), delete=False
            )
            args.append(job_file.name)

            with job_file as fp:
                yaml.dump(yaml.safe_load(job), stream=fp, encoding='utf-8')

        if run:
            return call(args, cwd=os.getcwd())
    finally:
        if job:
            os.unlink(job_file.name)