human
Give me a the Python code you requested given the following:
Complete the below
def can_access(func):

    ''''Check if User can Read/Update/Delete an Event.
    This is done by checking if the User has a Role in an Event.'
    '''
assistant
#Here is the Python code you requested.
    @wraps(func)
    def wrapper(*args, **kwargs):
        user = getattr(g, 'user', None)
        event_id = kwargs.get('event_id')
        if (not event_id):
            raise ServerError()
        get_object_or_404(EventModel, event_id)
        if (user and (user.has_role(event_id) or user.is_staff)):
            return func(*args, **kwargs)
        else:
            raise PermissionDeniedError()
    return wrapper