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

    """Check if User can Read/Update/Delete an Event.
    This is done by checking if the User has a Role in an Event.
    """
    @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