code: def pending_jobs(reschedule_in=None, limit=None, connection=None):
      
      if connection is None:
          connection = r
      start = None if limit is None else 0
      job_ids = connection.zrangebyscore(REDIS_KEY, 0, int(time.time()),
                                         start=start, num=limit)
  
      with connection.pipeline() as pipe:
          if reschedule_in is None:
              for job_id in job_ids:
                  pipe.zrem(REDIS_KEY, job_id)
          else:
              schedule_at = int(time.time()) + reschedule_in
              for job_id in job_ids:
                  args = (schedule_at, job_id)
                  if isinstance(connection, redis.Redis):
                      # StrictRedis or Redis don't have the same argument order
                      args = (job_id, schedule_at)
                  pipe.zadd(REDIS_KEY, *args)
          pipe.execute()
  
      with connection.pipeline() as pipe:
          for job_id in job_ids:
              pipe.hgetall(job_key(job_id.decode('utf-8')))
          jobs = pipe.execute()
      for job_id, data in izip(job_ids, jobs):
          job_data = {'id': job_id.decode('utf-8')}
          for key, value in data.items():
              try:
                  decoded = value.decode('utf-8')
              except UnicodeDecodeError:
                  decoded = value
              if decoded.isdigit():
                  decoded = int(decoded)
              job_data[key.decode('utf-8')] = decoded
          yield job_data
docs: Gets the job needing execution.
  
      :param reschedule_in: number of seconds in which returned jobs should be
      auto-rescheduled. If set to None (default), jobs are not auto-rescheduled.
      :param limit: max number of jobs to retrieve. If set to None (default),
      retrieves all pending jobs with no limit.