'Check whether the library is accessible to current user.'

def check_accessible(self, trans, library):

    if (not trans.app.security_agent.can_access_library(trans.get_current_user_roles(), library)):
        raise exceptions.ObjectNotFound('Library    with    the    id    provided    was    not    found.')
    elif library.deleted:
        raise exceptions.ObjectNotFound('Library    with    the    id    provided    is    deleted.')
    else:
        return library
