'Returns an array of jobs where the returned
jobs are matched by the provided filter arguments.
If a filter argument is in kwargs it will supersede the same argument
in the request object.
Filter arguments may be jobid, pools, user, tasks, text and state.
Filter by user ownership if check_permission is set to true.'

@jt_ha
def get_jobs(self, user, **kwargs):

    jobfunc = {'completed': (self.jt.completed_jobs, ThriftJobState.SUCCEEDED), 'succeeded': (self.jt.completed_jobs, ThriftJobState.SUCCEEDED), 'running': (self.jt.running_jobs, ThriftJobState.RUNNING), 'failed': (self.jt.failed_jobs, ThriftJobState.FAILED), 'killed': (self.jt.killed_jobs, ThriftJobState.KILLED), 'all': (self.jt.all_jobs, None), None: (self.jt.all_jobs, None)}
    selection = kwargs.pop('state')
    retired = kwargs.pop('retired')
    jobs = jobfunc[selection][0]().jobs
    if retired:
        jobs += self.jt.retired_jobs(jobfunc[selection][1]).jobs
    return self.filter_jobs(user, jobs, **kwargs)
