'Returns a list of pending jobs (if the scheduler hasn\'t been started yet) and scheduled jobs, either from a
specific job store or from all of them.
:param str|unicode jobstore: alias of the job store
:param bool pending: ``False`` to leave out pending jobs (jobs that are waiting for the scheduler start to be
added to their respective job stores), ``True`` to only include pending jobs, anything else
to return both
:rtype: list[Job]'

def get_jobs(self, jobstore=None, pending=None):

    with self._jobstores_lock:
        jobs = []
        if (pending is not False):
            for (job, alias, replace_existing) in self._pending_jobs:
                if ((jobstore is None) or (alias == jobstore)):
                    jobs.append(job)
        if (pending is not True):
            for (alias, store) in six.iteritems(self._jobstores):
                if ((jobstore is None) or (alias == jobstore)):
                    jobs.extend(store.get_all_jobs())
        return jobs
