human
Complete this python program:
def check_job_access_permission(exception_class=PopupException):
assistant
#Here is the Python program you requested.

    """Decorator ensuring that the user has access to the workflow or coordinator.
    Arg: \workflow\ or \coordinator\ id.
    Return: the workflow of coordinator or raise an exception
    Notice: its gets an id in input and returns the full object in output (not an id).
    """
    def inner(view_func):
        def decorate(request, *args, **kwargs):
            if ('workflow' in kwargs):
                job_type = 'workflow'
            elif ('coordinator' in kwargs):
                job_type = 'coordinator'
            else:
                job_type = 'bundle'
            job = kwargs.get(job_type)
            if (job is not None):
                job = Job.objects.can_read_or_exception(request, job, exception_class=exception_class)
            kwargs[job_type] = job
            return view_func(request, *args, **kwargs)
        return wraps(view_func)(decorate)
    return inner