<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_jobs(self, until=None, with_times=False, offset=None, length=None):
 """ Returns a iterator of job instances that will be queued until the given time. If no 'until' argument is given all jobs are returned. If with_times is True, a list of tuples consisting of the job instance and it's scheduled execution time is returned. If offset and length are specified, a slice of the list starting at the specified zero-based offset of the specified length will be returned. If either of offset or length is specified, then both must be, or an exception will be raised. """

        def epoch_to_datetime(epoch):
            return from_unix(float(epoch))

        until = rationalize_until(until)
        job_ids = self.connection.zrangebyscore(self.scheduled_jobs_key, 0,
                                                until, withscores=with_times,
                                                score_cast_func=epoch_to_datetime,
                                                start=offset, num=length)
        if not with_times:
            job_ids = zip(job_ids, repeat(None))
        for job_id, sched_time in job_ids:
            job_id = job_id.decode('utf-8')
            try:
                job = self.job_class.fetch(job_id, connection=self.connection)
            except NoSuchJobError:
                # Delete jobs that aren't there from scheduler
                self.cancel(job_id)
                continue
            if with_times:
                yield (job, sched_time)
            else:
                yield job