'Update the given library'

def update(self, trans, library, name=None, description=None, synopsis=None):

    changed = False
    if (not trans.user_is_admin()):
        raise exceptions.ItemAccessibilityException('Only    administrators    can    update    libraries.')
    if library.deleted:
        raise exceptions.RequestParameterInvalidException('You    cannot    modify    a    deleted    library.    Undelete    it    first.')
    if (name is not None):
        library.name = name
        changed = True
        folder_manager = folders.FolderManager()
        folder_manager.update(trans, library.root_folder, name=name)
    if (description is not None):
        library.description = description
        changed = True
    if (synopsis is not None):
        library.synopsis = synopsis
        changed = True
    if changed:
        trans.sa_session.add(library)
        trans.sa_session.flush()
    return library
