<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_job(self, key, func, args):
 """ Get a scheduled task or set if none exists. Returns: - task coroutine/continuation """

        res, pk = key
        jobs, lock = self._jobs
        task = _tasks.UpdateTask(func(*args), key)
        with lock:
            job = jobs[res].get(pk)
            had = bool(job)
            if not job:
                job = task
                jobs[res][pk] = job
            else:
                task.cancel()
        self._log.debug('Scheduling: %s-%s (%s)', res.tag, pk,
                        'new task' if not had else 'dup')
        return job