human
Complete this python program:
def check_dataset_access_permission(view_func):
assistant
#Here is the Python code you requested.

    """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).
    """
    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)