human
Complete the below
def check_dataset_access_permission(view_func):

    ''''Decorator ensuring that the user has access to dataset.
    Arg: \'dataset\'.
    Return: the dataset or raise an exception
    Notice: its gets an id in input and returns the full object in output (not an id).'
    '''

=====
Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.
    def decorate(request, *args, **kwargs):
        dataset = kwargs.get('dataset')
        if (dataset is not None):
            dataset = Dataset.objects.can_read_or_exception(request, dataset)
        kwargs['dataset'] = dataset
        return view_func(request, *args, **kwargs)
    return wraps(view_func)(decorate)